com.sshtools.j2ssh
Class SshThread
Thread
com.sshtools.j2ssh.SshThread
public class SshThread
extends Thread
Enables the J2SSH application framework to execute threads in the context of
a given session.
protected byte[] | sessionId - The raw session id generating during the first key exchange.
|
protected String | sessionIdString - A string representation of the session id.
|
protected String | username - The thread owner
|
SshThread(Runnable target, String name, boolean daemon) -
Constructs an SshThread.
|
SshThread(String name, boolean daemon)
|
sessionId
protected byte[] sessionId
The raw session id generating during the first key exchange.
sessionIdString
protected String sessionIdString
A string representation of the session id.
username
protected String username
The thread owner
SshThread
public SshThread(Runnable target,
String name,
boolean daemon)
Constructs an SshThread.
target
- The target to executename
- The name of the threaddaemon
- run as a daemon thread?
SshThread
public SshThread(String name,
boolean daemon)
cloneThread
public SshThread cloneThread(Runnable target,
String name)
Create's a cloned copy of this thread with the given target and name.
target
- the target to executename
- the thread name
containsProperty
public boolean containsProperty(String name)
Determine if this thread contains the given property.
name
- the name of the property
- true if the property exists, otherwise false
getCurrentSessionId
public static String getCurrentSessionId()
throws SshRuntimeException
Returns the session id of the current thread context.
This should be called when the caller is certain that the current thread
is running in an
SshThread
context. If not a Runtime
exception is thrown.
- the session id of the current thread
getCurrentThread
public static SshThread getCurrentThread()
throws SshRuntimeException
Returns the current
SshThread
.
This should be called when the caller is certain that the current thread
is running in an
SshThread
context. If not a Runtime
exception is thrown.
getCurrentThreadUser
public static String getCurrentThreadUser()
throws SshRuntimeException
Call to determine the username of the current thread context.
This should be called when the caller is certain that the current thread
is running in an
SshThread
context. If not a runtime
exception is thrown.
- the owner of the current thread
getProperty
public Object getProperty(String name)
Gets a property from this thread.
name
- the name of the property
getSessionIdString
public String getSessionIdString()
Returns the session id string for this thread.
- a string representation of the session id
getUsername
public String getUsername()
Gets the username for this thread.
hasUserContext
public static boolean hasUserContext()
setProperty
public void setProperty(String name,
Object value)
Sets a property in the thread.
name
- the name of the propertyvalue
- the property value
setSessionId
public void setSessionId(byte[] sessionId)
Sets the session id for this thread.
sessionId
- the session id created during the first key exchange.
setUsername
public void setUsername(String username)
Set the username for this thread.
username
- the thread owner
Copyright © 2002-2003 Lee David Painter & Contributors. All Rights Reserved.