Plugin question

I followed the plugin documentation and tried to run following simple plugin:

public class ListAgent extends BuildServerAdapter {
private SBuildServer myServer;

public ListAgent(SBuildServer server) {
server.addListener(this);
myServer = server;

List agents = server.getRegisteredAgents();
System.out.println("You have only agents: " + agents.size());

}
}

I have two agents connected to server. When i start the server, i always get
You have only agents: 0
message on tomcat console.

Am i missing something? What is the correct way of getting agents information on server.

Thanks all for help,

- star.

1 comment

Hi,

Yep, you're missing that build agents connect to the server after server startup, and your code in constructor is executed during server startup.

You can override BuildServerAdapter methods agentRegistered and agentUnregistered to get notified about agent connections/disconnections.

Hope this helps,
KIR

I followed the plugin documentation and tried to run
following simple plugin:

public class ListAgent extends BuildServerAdapter {
private SBuildServer myServer;
ublic ListAgent(SBuildServer server) {
server.addListener(this);
myServer = server;

List agents = server.getRegisteredAgents();
System.out.println("You have only agents: " +
agents.size());



I have two agents connected to server. When i start
the server, i always get
You have only agents: 0
message on tomcat console.

Am i missing something? What is the correct way of
getting agents information on server.

Thanks all for help,

- star.

0

Please sign in to leave a comment.