use of java.rmi.RemoteException in project neo4j by neo4j.
the class GraphDatabaseShellServer method welcome.
@Override
public Welcome welcome(Map<String, Serializable> initialSession) throws RemoteException, ShellException {
try (org.neo4j.graphdb.Transaction transaction = graphDb.beginTx()) {
Welcome welcome = super.welcome(initialSession);
transaction.success();
return welcome;
} catch (RuntimeException e) {
throw new RemoteException(e.getMessage(), e);
}
}
use of java.rmi.RemoteException in project neo4j by neo4j.
the class StartClientIT method shouldNotStartBolt.
@Test
public void shouldNotStartBolt() throws IOException {
// Given
AssertableLogProvider log = new AssertableLogProvider();
// When
new StartClient(System.out, System.err) {
@Override
protected GraphDatabaseShellServer getGraphDatabaseShellServer(File path, boolean readOnly, String configFile) throws RemoteException {
return new GraphDatabaseShellServer(new TestGraphDatabaseFactory().setUserLogProvider(log), path, readOnly, configFile);
}
}.start(new String[] { "-c", "RETURN 1;", "-path", db.getStoreDir(), "-config", getClass().getResource("/config-with-bolt-connector.conf").getFile() }, mock(CtrlCHandler.class));
// Then
log.assertNone(inLog(startsWith(WorkerFactory.class.getPackage().getName())).any());
}
use of java.rmi.RemoteException in project roboguice by roboguice.
the class ThrowingProviderTest method testProviderMethodWithManyExceptions.
public void testProviderMethodWithManyExceptions() {
try {
Guice.createInjector(new AbstractModule() {
protected void configure() {
install(ThrowingProviderBinder.forModule(this));
}
@SuppressWarnings("unused")
@CheckedProvides(RemoteProvider.class)
String foo() throws InterruptedException, RuntimeException, RemoteException, AccessException, TooManyListenersException {
return null;
}
});
fail();
} catch (CreationException ce) {
// The only two that should fail are Interrupted & TooManyListeners.. the rest are OK.
List<Message> errors = ImmutableList.copyOf(ce.getErrorMessages());
assertEquals(InterruptedException.class.getName() + " is not compatible with the exceptions ([" + RemoteException.class + "]) declared in the CheckedProvider interface (" + RemoteProvider.class.getName() + ")", errors.get(0).getMessage());
assertEquals(TooManyListenersException.class.getName() + " is not compatible with the exceptions ([" + RemoteException.class + "]) declared in the CheckedProvider interface (" + RemoteProvider.class.getName() + ")", errors.get(1).getMessage());
assertEquals(2, errors.size());
}
}
use of java.rmi.RemoteException in project spring-framework by spring-projects.
the class ThrowsAdviceInterceptorTests method testHandlerMethodThrowsException.
@Test
public void testHandlerMethodThrowsException() throws Throwable {
final Throwable t = new Throwable();
@SuppressWarnings("serial") MyThrowsHandler th = new MyThrowsHandler() {
@Override
public void afterThrowing(RemoteException ex) throws Throwable {
super.afterThrowing(ex);
throw t;
}
};
ThrowsAdviceInterceptor ti = new ThrowsAdviceInterceptor(th);
// Extends RemoteException
ConnectException ex = new ConnectException("");
MethodInvocation mi = mock(MethodInvocation.class);
given(mi.proceed()).willThrow(ex);
try {
ti.invoke(mi);
fail();
} catch (Throwable caught) {
assertEquals(t, caught);
}
assertEquals(1, th.getCalls());
assertEquals(1, th.getCalls("remoteException"));
}
use of java.rmi.RemoteException in project spring-framework by spring-projects.
the class RmiRegistryFactoryBean method getRegistry.
/**
* Locate or create the RMI registry.
* @param registryPort the registry port to use
* @return the RMI registry
* @throws RemoteException if the registry couldn't be located or created
*/
protected Registry getRegistry(int registryPort) throws RemoteException {
if (this.alwaysCreate) {
logger.info("Creating new RMI registry");
this.created = true;
return LocateRegistry.createRegistry(registryPort);
}
if (logger.isInfoEnabled()) {
logger.info("Looking for RMI registry at port '" + registryPort + "'");
}
synchronized (LocateRegistry.class) {
try {
// Retrieve existing registry.
Registry reg = LocateRegistry.getRegistry(registryPort);
testRegistry(reg);
return reg;
} catch (RemoteException ex) {
logger.debug("RMI registry access threw exception", ex);
logger.info("Could not detect RMI registry - creating new one");
// Assume no registry found -> create new one.
this.created = true;
return LocateRegistry.createRegistry(registryPort);
}
}
}
Aggregations