List of usage examples for java.rmi RemoteException RemoteException
public RemoteException(String s, Throwable cause)
From source file:org.kchine.rpf.db.DBLayer.java
public Vector<String> list(String[] prefixes) throws RemoteException, AccessException { Vector<String> result = new Vector<String>(); Statement stmt = null;/*from w w w . j a v a2s. c o m*/ ResultSet rset = null; try { checkConnection(); stmt = _connection.createStatement(); String stmtStr = "select NAME from SERVANTS where IN_USE=0 AND PING_FAILURES<" + PoolUtils.PING_FAILURES_NBR_MAX + " AND (NAME like '" + prefixes[0] + "%'"; for (int i = 1; i < prefixes.length; ++i) stmtStr += " OR NAME like '" + prefixes[i] + "%'"; stmtStr += ")"; rset = stmt.executeQuery(stmtStr); while (rset.next()) { result.add(rset.getString(1)); } } catch (SQLException sqle) { if (isNoConnectionError(sqle) && canReconnect()) { return list(prefixes); } else { throw new RemoteException("", (sqle)); } } finally { if (rset != null) try { stmt.close(); } catch (Exception e) { throw new RemoteException("", (e)); } if (stmt != null) try { stmt.close(); } catch (Exception e) { throw new RemoteException("", (e)); } } return result; }
From source file:org.kchine.rpf.db.DBLayer.java
public void lock() throws RemoteException, AccessException { Statement stmt = null;/* www . j a v a 2 s.c o m*/ try { checkConnection(); stmt = _connection.createStatement(); lock(stmt); } catch (SQLException sqle) { if (isNoConnectionError(sqle) && canReconnect()) { lock(); } else { throw new RemoteException("", (sqle)); } } finally { if (stmt != null) try { stmt.close(); } catch (Exception e) { throw new RemoteException("", (e)); } } }
From source file:org.kchine.rpf.db.DBLayer.java
public void unlock() throws RemoteException, AccessException { Statement stmt = null;//from w ww .j av a2 s .c o m try { checkConnection(); stmt = _connection.createStatement(); unlock(stmt); } catch (SQLException sqle) { if (isNoConnectionError(sqle) && canReconnect()) { unlock(); } else { throw new RemoteException("", (sqle)); } } finally { if (stmt != null) try { stmt.close(); } catch (Exception e) { throw new RemoteException("", (e)); } } }
From source file:org.kchine.rpf.db.DBLayer.java
public void reserve(String name) throws RemoteException, NotBoundException, AccessException { Statement stmt = null;// w w w.ja va2 s. co m try { checkConnection(); stmt = _connection.createStatement(); stmt.execute("UPDATE SERVANTS SET IN_USE=1, BORROW_TIME=" + sysdateFunctionName() + ",BORROW_HOST_NAME='" + getHostName() + "'" + ",BORROW_HOST_IP='" + getHostIp() + "'" + ",BORROW_PROCESS_ID='" + getProcessId() + "'" + ",BORROW_SESSION_INFO_HEX=" + (RPFSessionInfo.get() == null ? "NULL" : "'" + objectToHex(RPFSessionInfo.get()) + "'") + ",RETURN_TIME=NULL" + ",RETURN_HOST_NAME=NULL" + ",RETURN_HOST_IP=NULL" + ",RETURN_PROCESS_ID=NULL" + " WHERE NAME='" + name + "'"); } catch (SQLException sqle) { if (isNoConnectionError(sqle) && canReconnect()) { reserve(name); } else { throw new RemoteException("", (sqle)); } } finally { if (stmt != null) try { stmt.close(); } catch (Exception e) { throw new RemoteException("", (e)); } } }
From source file:org.kchine.rpf.db.DBLayer.java
public void unReserve(String name) throws RemoteException, NotBoundException, AccessException { Statement stmt = null;/* w ww.ja v a2s. c o m*/ try { checkConnection(); stmt = _connection.createStatement(); stmt.execute("UPDATE SERVANTS SET IN_USE=0 " + ",RETURN_TIME=" + sysdateFunctionName() + ",RETURN_HOST_NAME='" + getHostName() + "'" + ",RETURN_HOST_IP='" + getHostIp() + "'" + ",RETURN_PROCESS_ID='" + getProcessId() + "'" + " WHERE NAME='" + name + "'"); } catch (SQLException sqle) { if (isNoConnectionError(sqle) && canReconnect()) { unReserve(name); } else { throw new RemoteException("", (sqle)); } } finally { if (stmt != null) try { stmt.close(); } catch (Exception e) { throw new RemoteException("", (e)); } } }
From source file:org.kchine.rpf.db.DBLayer.java
public void registerPingFailure(String name) throws RemoteException, NotBoundException, AccessException { Statement stmt = null;// w w w . j a va 2 s. com try { checkConnection(); stmt = _connection.createStatement(); stmt.execute("update SERVANTS SET PING_FAILURES=(PING_FAILURES+1) WHERE NAME='" + name + "'"); } catch (SQLException sqle) { if (isNoConnectionError(sqle) && canReconnect()) { registerPingFailure(name); } else { throw new RemoteException("", (sqle)); } } finally { if (stmt != null) try { stmt.close(); } catch (Exception e) { throw new RemoteException("", (e)); } } }
From source file:org.kchine.rpf.db.DBLayer.java
public void incrementNodeProcessCounter(String nodeName) throws RemoteException, NotBoundException, AccessException { Statement stmt = null;//www . jav a 2 s .c om try { checkConnection(); stmt = _connection.createStatement(); stmt.execute( "update NODE_DATA set PROCESS_COUNTER=(PROCESS_COUNTER+1) WHERE NODE_NAME='" + nodeName + "'"); _connection.commit(); } catch (SQLException sqle) { if (isNoConnectionError(sqle) && canReconnect()) { incrementNodeProcessCounter(nodeName); } else { throw new RemoteException("", (sqle)); } } finally { if (stmt != null) try { stmt.close(); } catch (Exception e) { throw new RemoteException("", (e)); } } }
From source file:org.kchine.rpf.db.DBLayer.java
public void updateServantNodeName(String servantName, String nodeName) throws RemoteException, NotBoundException, AccessException { Statement stmt = null;//from w w w . j a v a 2s . co m try { checkConnection(); stmt = _connection.createStatement(); stmt.execute("update SERVANTS SET NODE_NAME='" + nodeName + "' WHERE NAME='" + servantName + "'"); _connection.commit(); } catch (SQLException sqle) { if (isNoConnectionError(sqle) && canReconnect()) { updateServantNodeName(servantName, nodeName); } else { throw new RemoteException("", (sqle)); } } finally { if (stmt != null) try { stmt.close(); } catch (Exception e) { throw new RemoteException("", (e)); } } }
From source file:org.kchine.rpf.db.DBLayer.java
public void updateServantAttributes(String servantName, HashMap<String, Object> attributes) throws RemoteException, NotBoundException, AccessException { Statement stmt = null;/*from w w w . ja v a 2 s . c o m*/ try { checkConnection(); stmt = _connection.createStatement(); stmt.execute("update SERVANTS SET ATTRIBUTES_HEX='" + PoolUtils.objectToHex(attributes) + "' WHERE NAME='" + servantName + "'"); _connection.commit(); } catch (SQLException sqle) { if (isNoConnectionError(sqle) && canReconnect()) { updateServantAttributes(servantName, attributes); } else { throw new RemoteException("", (sqle)); } } finally { if (stmt != null) try { stmt.close(); } catch (Exception e) { throw new RemoteException("", (e)); } } }
From source file:org.kchine.rpf.db.DBLayer.java
public Remote getRemoteObject(String stub, String codeBaseStr) throws RemoteException { try {/*from ww w .jav a2 s . c o m*/ ClassLoader cl = null; if (codeBaseStr != null) { cl = new URLClassLoader(new URL[] { new URL(codeBaseStr) }, DBLayer.class.getClassLoader()); } return hexToStub(stub, cl); } catch (Exception e) { throw new RemoteException("", (e)); } }