本文整理汇总了Java中java.rmi.server.ServerNotActiveException类的典型用法代码示例。如果您正苦于以下问题:Java ServerNotActiveException类的具体用法?Java ServerNotActiveException怎么用?Java ServerNotActiveException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ServerNotActiveException类属于java.rmi.server包,在下文中一共展示了ServerNotActiveException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setHostResult
import java.rmi.server.ServerNotActiveException; //导入依赖的package包/类
@Override
public void setHostResult(HostAndCommand hostAndCommand, HostResult result) {
try {
Log.warning("set host result "+ hostAndCommand +" from "+ getClientHost());
} catch (ServerNotActiveException snae) {
snae.printStackTrace();
}
activeHostCommands.remove(hostAndCommand);
incompleteHostCommands.remove(hostAndCommand);
completeHostCommands.add(hostAndCommand);
if (incompleteHostCommands.size() == 0) {
try {
pendingHostCommands.put(DONE_MARKER);
} catch (InterruptedException ie) {
}
if (terminateUponCompletion) {
if (beginTermination()) {
displayIncomplete();
}
} else {
displayIncomplete();
}
}
logState();
}
示例2: rconfigure
import java.rmi.server.ServerNotActiveException; //导入依赖的package包/类
/**
* Adds a feature to the ThreadGroup attribute of the RemoteJMeterEngineImpl
* object.
*
* @param testTree
* the feature to be added to the ThreadGroup attribute
*/
@Override
public void rconfigure(HashTree testTree, String host, File jmxBase, String scriptName) throws RemoteException {
log.info("Creating JMeter engine on host "+host+" base '"+jmxBase+"'");
try {
log.info("Remote client host: " + getClientHost());
} catch (ServerNotActiveException e) {
// ignored
}
synchronized(LOCK) { // close window where another remote client might jump in
if (backingEngine != null && backingEngine.isActive()) {
log.warn("Engine is busy - cannot create JMeter engine");
throw new IllegalStateException("Engine is busy - please try later");
}
ownerThread = Thread.currentThread();
backingEngine = new StandardJMeterEngine(host);
backingEngine.configure(testTree); // sets active = true
}
FileServer.getFileServer().setScriptName(scriptName);
FileServer.getFileServer().setBase(jmxBase);
}
示例3: registra
import java.rmi.server.ServerNotActiveException; //导入依赖的package包/类
@Override
public String registra(String nombre, FileServer fl)
throws RemoteException {
String localizador = null;
try {
localizador = FileSearchImpl.getClientHost() + "/" + nombre;
this.oremotos.put(localizador, fl);
System.out.println("LOG: " + FileSearchImpl.class.getName()
+ ": registra(): " + localizador + ".");
} catch (ServerNotActiveException ex) {
/* Cliente desaparecido en combate */
System.out.println("LOG: " + FileSearchImpl.class.getName()
+ ": registra(): "
+ "Intento de registro por cliente no accesible.");
}
return localizador;
}
示例4: registerServer
import java.rmi.server.ServerNotActiveException; //导入依赖的package包/类
@Override
public boolean registerServer(String key, RMIServiceInterface service) throws RemoteException {
for (ManagedServerInformationNode node
: getServer().getServerConfig().getManagedServers().values()) {
if (node.getServerKey().equals(key)) {
try {
// 注册服务
node.setRemoteService(service);
node.setServerRMIAddress(service.getServerRMIAddress());
// 输出日志
logger.info(
String.format("服务节点 [%s] 上线.服务地址为 [%s] .",
node.getServerType(),
RemoteServer.getClientHost()));
return true;
} catch (ServerNotActiveException ex) {
logger.error("尝试注册服务失败:", ex);
}
}
}
return false;
}
示例5: createSession
import java.rmi.server.ServerNotActiveException; //导入依赖的package包/类
@Override
public long createSession(String name, String password) throws java.rmi.RemoteException {
try {
validate(name, password);
} catch (JDependException e1) {
e1.printStackTrace();
throw new RemoteException(e1.getMessage(), e1);
}
JDependSession session = new JDependSession();
session.setId(UUID.randomUUID().getLeastSignificantBits());
session.setUserName(name);
try {
session.setClient(getClientHost());
} catch (ServerNotActiveException e) {
e.printStackTrace();
}
JDependSessionMgr.getInstance().putSession(session);
return session.getId();
}
示例6: notifyStateChange
import java.rmi.server.ServerNotActiveException; //导入依赖的package包/类
/**
* notify all clients of state change. If connection fails, this will modify
* client hashmaps. Therefore callers should not iterate directly over the
* clientWaitingForAgent and clientWaitingForHuman arrays.
*
* @param newState
* @throws RemoteException
*/
public void notifyStateChange(EnvironmentState newState) {
// duplicate the set before iteration, since we may call
// unregisterClient.
Set<BW4TClientActions> clientset = new HashSet<>(this.clients.keySet());
for (BW4TClientActions client : clientset) {
try {
client.handleStateChange(newState);
} catch (RemoteException e) {
reportClientProblem(client, e);
try {
unregisterClient(client);
} catch (ServerNotActiveException e1) {
e1.printStackTrace();
}
}
}
}
示例7: checkAccessPrivilegies
import java.rmi.server.ServerNotActiveException; //导入依赖的package包/类
/**
* Checks if the current client has privilegies to modify the contents of
* the registry. All non-local clients should be rejected.
*
* @throws AccessException
* if registry denies the caller access to perform this
* operation
*/
private final void checkAccessPrivilegies() throws AccessException {
String hostName;
try {
hostName = RemoteServer.getClientHost();
} catch (ServerNotActiveException e) {
// if no remote host is currently executing this method,
// then is localhost, and the access should be granted.
return;
}
if (hostName == null) {
throw new AccessException("Can not get remote host address.");
}
if (!localIPs.contains(hostName)) {
throw new AccessException(
"Registry can not be modified by this host.");
}
}
示例8: execute
import java.rmi.server.ServerNotActiveException; //导入依赖的package包/类
/**
* Tests the hosts status.
*
* @param arguments an arbitrary number of hosts
* @return a boolean value
* @throws RemoteException if the remote operation fails
*/
public Object execute(Object... arguments) throws RemoteException {
String host;
String client;
if ((Integer)arguments[0] > 1) {
i++;
host = (String) arguments[i];
} else {
host = (String) arguments[1];
}
try {
client = getClientHost();
} catch (ServerNotActiveException e) {
client = System.getProperty("java.rmi.server.hostname");
}
if (host.equals(client)) {
out.println("\t\tHost " + client + " work well");
return true;
} else {
out.println("\t\tHost " + client + " don't work, this host wasn't " + host);
return false;
}
}
示例9: execute
import java.rmi.server.ServerNotActiveException; //导入依赖的package包/类
/**
* Executes an object a specified number of times.
*
* @param obj a <code>ServerExecutor</code>
* @param times of the executions
* @param arguments an arbitrary number of hosts
* @return a result of the execution
* @throws RemoteException if the remote operation fails
*/
public Object execute(ServerExecutor obj, int times, Object... arguments)
throws RemoteException {
if (!imInServer()) {
try {
System.out.println("\t\tExcecuting execute client: " + getClientHost() + " my: " + ReportIPServer.localHost());
} catch (ServerNotActiveException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
for (int i = 0; i < times - 1; i++) {
obj.execute(arguments);
}
return obj.execute(arguments);
}
示例10: sumMatrixAB
import java.rmi.server.ServerNotActiveException; //导入依赖的package包/类
public int[][] sumMatrixAB() {
if ((m1 == null)|| (m2 == null)) {
throw new RuntimeException("Matrix not loaded");
}
try {
System.out.println("add Matrix called from "+getClientHost());
} catch (ServerNotActiveException e) {
e.printStackTrace();
}
int[][] result = new int[m1.length][m2.length];
int i, j;
for (i = 0; i < m1.length; i++) {
for (j = 0; j < m2.length; j++) {
result [i][j] = m1 [i][j] + m2 [i][j];
}
}
System.out.println("Result Matrix (add)");
System.out.println(Arrays.toString(result[0]));
System.out.println(Arrays.toString(result[1]));
System.out.println();
return result;
}
示例11: sumMatrixAB
import java.rmi.server.ServerNotActiveException; //导入依赖的package包/类
public BigInteger[][] sumMatrixAB() {
if ((m1 == null)|| (m2 == null)) {
throw new RuntimeException("Matrix not loaded");
}
try {
System.out.println("add Matrix called from "+getClientHost());
} catch (ServerNotActiveException e) {
e.printStackTrace();
}
BigInteger[][] result = new BigInteger[m1.length][m2.length];
int i, j;
for (i = 0; i < m1.length; i++) {
for (j = 0; j < m2.length; j++) {
result [i][j] = m1 [i][j].add(m2 [i][j]);
}
}
System.out.println("Result Matrix (add)");
System.out.println(Arrays.toString(result[0]));
System.out.println(Arrays.toString(result[1]));
System.out.println();
return result;
}
示例12: execute
import java.rmi.server.ServerNotActiveException; //导入依赖的package包/类
/**
* Tests the hosts status.
*
* @param arguments an arbitrary number of hosts
* @return a boolean value
* @throws RemoteExcpetion if the remote operation fails
*/
public Object execute(Object... arguments) throws RemoteException {
String host;
String client;
if ((Integer)arguments[0] > 1) {
host = (String) arguments[i++];
} else {
host = (String) arguments[1];
}
try {
client = getClientHost();
} catch (ServerNotActiveException e) {
client = System.getProperty("java.rmi.server.hostname");
}
if (host.equals(client)) {
out.println("\t\tHost " + client + " work well");
return true;
} else {
out.println("\t\tHost " + client + " don't work, this host wasn't " + host);
return false;
}
}
示例13: sumMatrixAB
import java.rmi.server.ServerNotActiveException; //导入依赖的package包/类
public int[][] sumMatrixAB() {
if ((m1 == null) || (m2 == null)) {
throw new RuntimeException("Matrix not loaded");
}
try {
System.out.println("add Matrix called from " + getClientHost());
} catch (ServerNotActiveException e) {
e.printStackTrace();
}
int[][] result = new int[m1.length][m2.length];
int i, j;
for (i = 0; i < m1.length; i++) {
for (j = 0; j < m2.length; j++) {
result[i][j] = m1[i][j] + m2[i][j];
}
}
System.out.println("Result Matrix (add)");
System.out.println(Arrays.toString(result[0]));
System.out.println(Arrays.toString(result[1]));
System.out.println();
return result;
}
示例14: sumMatrixAB
import java.rmi.server.ServerNotActiveException; //导入依赖的package包/类
public BigInteger[][] sumMatrixAB() {
if ((m1 == null) || (m2 == null)) {
throw new RuntimeException("Matrix not loaded");
}
try {
System.out.println("add Matrix called from " + getClientHost());
} catch (ServerNotActiveException e) {
e.printStackTrace();
}
BigInteger[][] result = new BigInteger[m1.length][m2.length];
int i, j;
for (i = 0; i < m1.length; i++) {
for (j = 0; j < m2.length; j++) {
result[i][j] = m1[i][j].add(m2[i][j]);
}
}
System.out.println("Result Matrix (add)");
System.out.println(Arrays.toString(result[0]));
System.out.println(Arrays.toString(result[1]));
System.out.println();
return result;
}
示例15: getSolver
import java.rmi.server.ServerNotActiveException; //导入依赖的package包/类
/**
* @see edu.harvard.econcs.jopt.solver.server.ISolverServer#getSolver()
*/
public IRemoteMIPSolver getSolver() throws RemoteException {
String client = "Unknown";
try {
client = getClientHost();
} catch (ServerNotActiveException e) {
logger.warn("Could not get client host: " + e.getMessage());
}
logger.info("Creating Load Balancing Remote Solver for: " + client);
return new BalancingRemoteMIPSolver();
}