public abstract class ConnectionFactory
extends java.lang.Object
You can create multiple concurrent connections. For example, you could aggregate information from multiple remote JVMs.
Connection
Constructor and Description |
---|
ConnectionFactory() |
Modifier and Type | Method and Description |
---|---|
static Connection |
createRemoteConnection(java.lang.String hostname,
int port,
int timeout)
Opens a connection to a remote JVM.
|
static Connection |
createRemoteConnection(java.lang.String hostname,
int port,
int timeout,
int sessionId,
java.io.File configFile)
Opens a connection to a remote JVM.
|
static Connection |
createSnapshotConnection(java.io.File snapshot,
java.io.File configFile)
Opens a connection to a saved snapshot file.
|
static Connection |
getLocalConnection()
Opens a connection to the JVM of the current process.
|
public static Connection getLocalConnection() throws java.io.IOException
For technical reasons this implies that the JVM was started with the "nowait" and "id" option in the -agentpath:[path to jprofilerti library] VM parameter, otherwise the profiling agent would be waiting for a connection and you would not be able to execute this method call.
java.io.IOException
- if the connection failspublic static Connection createSnapshotConnection(java.io.File snapshot, java.io.File configFile) throws java.io.IOException
snapshot
- the snapshot fileconfigFile
- the config.xml file of JProfiler. If this parameter is null, the default config file
from the current user's home directory will be used (if it exists).java.io.IOException
- if the file does not exist or the connection fails for some other reasonpublic static Connection createRemoteConnection(java.lang.String hostname, int port, int timeout) throws java.io.IOException
hostname
- the host name or the IP address of the remote computerport
- the port on which the remote profiling agent is listening. The default value is 8849.timeout
- the timeout in secondsjava.io.IOException
- if the connection fails or times outpublic static Connection createRemoteConnection(java.lang.String hostname, int port, int timeout, int sessionId, java.io.File configFile) throws java.io.IOException
hostname
- the host name or the IP address of the remote computerport
- the port on which the remote profiling agent is listening. The default value is 8849.timeout
- the timeout in secondssessionId
- the id of the session used to profileconfigFile
- the config.xml file of JProfiler. If this parameter is null, the default config file
from the current user's home directory will be used (if it exists).java.io.IOException
- if the connection fails or times out