public class BrokerManager
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static java.util.Map<java.lang.String,Broker> |
activeBrokers
Brokers registry
|
private static java.util.logging.Logger |
LOG
Logger.
|
private static SessionListener |
sessionListener
Session listener
|
Constructor and Description |
---|
BrokerManager() |
Modifier and Type | Method and Description |
---|---|
static void |
cleanup()
Called on server shutdown from a server hook.
|
private static BrokerParameters |
findBroker(java.lang.String uuid)
Find a broker using the given ID.
|
private static java.util.List<java.lang.String> |
getBrokerAccounts(DirectoryService ds,
java.lang.String broker)
Get a list of P2J accounts which are served by this broker or and empty list if
no accounts are configured for this broker.
|
static Brokers |
getBrokers(java.lang.String user)
Get a list of brokers for the given P2J or OS user account.
|
private static java.util.List<BrokerParameters> |
getBrokersForUser(java.lang.String user)
Get a list of brokers for a specified account.
|
static void |
initialize()
Read brokers configuration from directory.
|
static java.lang.String |
registerBroker()
Register a remote launcher (broker).
|
private static void |
removeBroker(Session session)
Remove a broker from registry when the remote session is closed.
|
private static BrokerParameters |
schedule(java.util.List<BrokerParameters> brokers)
Select a broker from the broker list which has the lowest system loading.
|
static BrokerSpawnResult |
spawn(Brokers brokers,
BrokerSpawnParameters args)
Spawn a process remotely via a broker.
|
static void |
start(java.lang.String uuid)
Open a communication route to broker.
|
private static final java.util.logging.Logger LOG
private static java.util.Map<java.lang.String,Broker> activeBrokers
private static SessionListener sessionListener
public static void initialize()
public static void cleanup()
public static java.lang.String registerBroker()
BrokerServerServices.registerBroker()
public static void start(java.lang.String uuid)
uuid
- Broker UUID.public static BrokerSpawnResult spawn(Brokers brokers, BrokerSpawnParameters args)
For brokers having the user name defined in the list of accounts a broker is selected from list based on system loading reported by broker and this broker is used to launch the remote client. On error no other brokers are selected.
brokers
- List of available brokers.args
- Process parameters.public static Brokers getBrokers(java.lang.String user)
user
- P2J or OS user account.private static BrokerParameters schedule(java.util.List<BrokerParameters> brokers)
brokers
- List of brokers.private static java.util.List<BrokerParameters> getBrokersForUser(java.lang.String user)
user
- User account. If null select a list of brokers having no accounts.private static BrokerParameters findBroker(java.lang.String uuid)
uuid
- Broker ID.private static void removeBroker(Session session)
session
- Broker session instance.private static java.util.List<java.lang.String> getBrokerAccounts(DirectoryService ds, java.lang.String broker)
ds
- Directory services API.broker
- Directory path of this broker.