projects
/
lttng-ust.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Turn ISessiondCommand into an abstract class
[lttng-ust.git]
/
liblttng-ust-java-agent
/
java
/
lttng-ust-agent-common
/
org
/
lttng
/
ust
/
agent
/
client
/
LttngTcpSessiondClient.java
diff --git
a/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/client/LttngTcpSessiondClient.java
b/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/client/LttngTcpSessiondClient.java
index 3e9e24dd65463d2100d7d8095595919a24cddbcb..2b31889c3019a5ae88864dee2995c42f34086c51 100644
(file)
--- a/
liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/client/LttngTcpSessiondClient.java
+++ b/
liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/client/LttngTcpSessiondClient.java
@@
-31,8
+31,6
@@
import java.nio.ByteOrder;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
-import org.lttng.ust.agent.AbstractLttngAgent;
-
/**
* Client for agents to connect to a local session daemon, using a TCP socket.
*
/**
* Client for agents to connect to a local session daemon, using a TCP socket.
*
@@
-44,8
+42,8
@@
public class LttngTcpSessiondClient implements Runnable {
private static final String ROOT_PORT_FILE = "/var/run/lttng/agent.port";
private static final String USER_PORT_FILE = "/.lttng/agent.port";
private static final String ROOT_PORT_FILE = "/var/run/lttng/agent.port";
private static final String USER_PORT_FILE = "/.lttng/agent.port";
- private static
int protocolMajorVersion = 1
;
- private static
int protocolMinorVersion
= 0;
+ private static
final int PROTOCOL_MAJOR_VERSION = 2
;
+ private static
final int PROTOCOL_MINOR_VERSION
= 0;
/** Command header from the session deamon. */
private final CountDownLatch registrationLatch = new CountDownLatch(1);
/** Command header from the session deamon. */
private final CountDownLatch registrationLatch = new CountDownLatch(1);
@@
-56,21
+54,26
@@
public class LttngTcpSessiondClient implements Runnable {
private DataInputStream inFromSessiond;
private DataOutputStream outToSessiond;
private DataInputStream inFromSessiond;
private DataOutputStream outToSessiond;
- private final AbstractLttngAgent<?> logAgent;
+ private final ILttngTcpClientListener logAgent;
+ private final int domainValue;
private final boolean isRoot;
private final boolean isRoot;
-
/**
* Constructor
*
* @param logAgent
/**
* Constructor
*
* @param logAgent
- * The logging agent this client will operate on.
+ * The listener this client will operate on, typically an LTTng
+ * agent.
+ * @param domainValue
+ * The integer to send to the session daemon representing the
+ * tracing domain to handle.
* @param isRoot
* True if this client should connect to the root session daemon,
* false if it should connect to the user one.
*/
* @param isRoot
* True if this client should connect to the root session daemon,
* false if it should connect to the user one.
*/
- public LttngTcpSessiondClient(
AbstractLttngAgent<?> logAgent
, boolean isRoot) {
+ public LttngTcpSessiondClient(
ILttngTcpClientListener logAgent, int domainValue
, boolean isRoot) {
this.logAgent = logAgent;
this.logAgent = logAgent;
+ this.domainValue = domainValue;
this.isRoot = isRoot;
}
this.isRoot = isRoot;
}
@@
-206,10
+209,10
@@
public class LttngTcpSessiondClient implements Runnable {
ByteBuffer buf = ByteBuffer.wrap(data);
String pid = ManagementFactory.getRuntimeMXBean().getName().split("@")[0];
ByteBuffer buf = ByteBuffer.wrap(data);
String pid = ManagementFactory.getRuntimeMXBean().getName().split("@")[0];
- buf.putInt(
logAgent.getDomain().value()
);
+ buf.putInt(
domainValue
);
buf.putInt(Integer.parseInt(pid));
buf.putInt(Integer.parseInt(pid));
- buf.putInt(
protocolMajorVersion
);
- buf.putInt(
protocolMinorVersion
);
+ buf.putInt(
PROTOCOL_MAJOR_VERSION
);
+ buf.putInt(
PROTOCOL_MINOR_VERSION
);
this.outToSessiond.write(data, 0, data.length);
this.outToSessiond.flush();
}
this.outToSessiond.write(data, 0, data.length);
this.outToSessiond.flush();
}
@@
-247,8
+250,8
@@
public class LttngTcpSessiondClient implements Runnable {
}
case CMD_LIST:
{
}
case CMD_LIST:
{
-
I
SessiondCommand listLoggerCmd = new SessiondListLoggersCommand();
-
I
LttngAgentResponse response = listLoggerCmd.execute(logAgent);
+ SessiondCommand listLoggerCmd = new SessiondListLoggersCommand();
+ LttngAgentResponse response = listLoggerCmd.execute(logAgent);
responseData = response.getBytes();
break;
}
responseData = response.getBytes();
break;
}
@@
-256,11
+259,11
@@
public class LttngTcpSessiondClient implements Runnable {
{
if (inputData == null) {
/* Invalid command */
{
if (inputData == null) {
/* Invalid command */
- responseData =
I
LttngAgentResponse.FAILURE_RESPONSE.getBytes();
+ responseData = LttngAgentResponse.FAILURE_RESPONSE.getBytes();
break;
}
break;
}
-
I
SessiondCommand enableCmd = new SessiondEnableEventCommand(inputData);
-
I
LttngAgentResponse response = enableCmd.execute(logAgent);
+ SessiondCommand enableCmd = new SessiondEnableEventCommand(inputData);
+ LttngAgentResponse response = enableCmd.execute(logAgent);
responseData = response.getBytes();
break;
}
responseData = response.getBytes();
break;
}
@@
-268,11
+271,11
@@
public class LttngTcpSessiondClient implements Runnable {
{
if (inputData == null) {
/* Invalid command */
{
if (inputData == null) {
/* Invalid command */
- responseData =
I
LttngAgentResponse.FAILURE_RESPONSE.getBytes();
+ responseData = LttngAgentResponse.FAILURE_RESPONSE.getBytes();
break;
}
break;
}
-
I
SessiondCommand disableCmd = new SessiondDisableEventCommand(inputData);
-
I
LttngAgentResponse response = disableCmd.execute(logAgent);
+ SessiondCommand disableCmd = new SessiondDisableEventCommand(inputData);
+ LttngAgentResponse response = disableCmd.execute(logAgent);
responseData = response.getBytes();
break;
}
responseData = response.getBytes();
break;
}
This page took
0.028329 seconds
and
4
git commands to generate.