Search in sources :

Example 6 with RemoteException

use of java.rmi.RemoteException in project qi4j-sdk by Qi4j.

the class InputOutputTest method testInputOutputInputException.

@Test(expected = RemoteException.class)
public void testInputOutputInputException() throws IOException {
    Input<String, RemoteException> input = new Input<String, RemoteException>() {

        @Override
        public <OutputThrowableType extends Throwable> void transferTo(Output<? super String, OutputThrowableType> output) throws RemoteException, OutputThrowableType {
            output.receiveFrom(new Sender<String, RemoteException>() {

                @Override
                public <ReceiverThrowableType extends Throwable> void sendTo(Receiver<? super String, ReceiverThrowableType> receiverThrowableTypeReceiver) throws ReceiverThrowableType, RemoteException {
                    throw new RemoteException();
                }
            });
        }
    };
    input.transferTo(Transforms.map(new Transforms.Log<String>(LoggerFactory.getLogger(getClass()), "Line: {0}"), Outputs.systemOut()));
}
Also used : RemoteException(java.rmi.RemoteException) Test(org.junit.Test)

Example 7 with RemoteException

use of java.rmi.RemoteException in project Openfire by igniterealtime.

the class CrowdGroupProvider method getGroup.

@Override
public Group getGroup(String name) throws GroupNotFoundException {
    try {
        Cache<String, org.jivesoftware.openfire.crowd.jaxb.Group> groupCache = CacheFactory.createLocalCache(GROUP_CACHE_NAME);
        org.jivesoftware.openfire.crowd.jaxb.Group group = groupCache.get(name);
        if (group == null) {
            group = manager.getGroup(name);
            groupCache.put(name, group);
        }
        Collection<JID> members = getGroupMembers(name);
        Collection<JID> admins = Collections.emptyList();
        return new Group(name, group.description, members, admins);
    } catch (RemoteException re) {
        LOG.error("Failure to load group:" + String.valueOf(name), re);
        throw new GroupNotFoundException(re);
    }
}
Also used : Group(org.jivesoftware.openfire.group.Group) JID(org.xmpp.packet.JID) GroupNotFoundException(org.jivesoftware.openfire.group.GroupNotFoundException) RemoteException(java.rmi.RemoteException)

Example 8 with RemoteException

use of java.rmi.RemoteException in project neo4j by neo4j.

the class AbstractAppServer method tabComplete.

@Override
public TabCompletion tabComplete(Serializable clientID, String partOfLine) throws ShellException, RemoteException {
    // TODO We can't assume it's an AppShellServer, can we?
    try {
        AppCommandParser parser = new AppCommandParser(this, partOfLine);
        App app = parser.app();
        List<String> appCandidates = app.completionCandidates(partOfLine, getClientSession(clientID));
        appCandidates = quote(appCandidates);
        if (appCandidates.size() == 1) {
            appCandidates.set(0, appCandidates.get(0) + " ");
        }
        int cursor = partOfLine.length() - TextUtil.lastWordOrQuoteOf(partOfLine, true).length();
        return new TabCompletion(appCandidates, cursor);
    } catch (Exception e) {
        throw wrapException(e);
    }
}
Also used : App(org.neo4j.shell.App) TabCompletion(org.neo4j.shell.TabCompletion) AppCommandParser(org.neo4j.shell.AppCommandParser) RemoteException(java.rmi.RemoteException) ShellException(org.neo4j.shell.ShellException)

Example 9 with RemoteException

use of java.rmi.RemoteException in project neo4j by neo4j.

the class LegacyDatabaseImpl method start.

public static Future<LegacyDatabase> start(String classpath, File storeDir, Map<String, String> config) throws Exception {
    List<String> args = new ArrayList<String>();
    args.add(storeDir.getAbsolutePath());
    int rmiPort = 7000 + parseInt(config.get("ha.server_id"));
    args.add("" + rmiPort);
    args.addAll(asList(new Args(config).asArgs()));
    final Process process = execJava(appendNecessaryTestClasses(classpath), LegacyDatabaseImpl.class.getName(), args.toArray(new String[0]));
    new ProcessStreamHandler(process, false).launch();
    final RmiLocation rmiLocation = rmiLocation(rmiPort);
    ExecutorService executor = newSingleThreadExecutor();
    Future<LegacyDatabase> future = executor.submit(new Callable<LegacyDatabase>() {

        @Override
        public LegacyDatabase call() throws Exception {
            long endTime = currentTimeMillis() + SECONDS.toMillis(10000);
            while (currentTimeMillis() < endTime) {
                try {
                    return (LegacyDatabase) rmiLocation.getBoundObject();
                } catch (RemoteException e) {
                    // OK
                    sleep(100);
                }
            }
            process.destroy();
            throw new IllegalStateException("Couldn't get remote to legacy database");
        }
    });
    executor.shutdown();
    return future;
}
Also used : Args(org.neo4j.helpers.Args) RmiLocation(org.neo4j.shell.impl.RmiLocation) ArrayList(java.util.ArrayList) Exceptions.launderedException(org.neo4j.helpers.Exceptions.launderedException) RemoteException(java.rmi.RemoteException) ExecutorService(java.util.concurrent.ExecutorService) ProcessStreamHandler(org.neo4j.test.ProcessStreamHandler) RemoteException(java.rmi.RemoteException)

Example 10 with RemoteException

use of java.rmi.RemoteException in project neo4j by neo4j.

the class ShellTabCompleter method complete.

public int complete(String buffer, int cursor, List candidates) {
    if (buffer == null || buffer.length() == 0) {
        return cursor;
    }
    try {
        if (buffer.contains(" ")) {
            TabCompletion completion = client.getServer().tabComplete(client.getId(), buffer.trim());
            cursor = completion.getCursor();
            //noinspection unchecked
            candidates.addAll(completion.getCandidates());
        } else {
            // Complete the app name
            return getAppNameCompleter().complete(buffer, cursor, candidates);
        }
    } catch (RemoteException e) {
        // TODO Throw something?
        e.printStackTrace();
    } catch (ShellException e) {
        // TODO Throw something?
        e.printStackTrace();
    }
    return cursor;
}
Also used : TabCompletion(org.neo4j.shell.TabCompletion) RemoteException(java.rmi.RemoteException) ShellException(org.neo4j.shell.ShellException)

Aggregations

RemoteException (java.rmi.RemoteException)368 IOException (java.io.IOException)54 VmwareContext (com.cloud.hypervisor.vmware.util.VmwareContext)38 VmwareHypervisorHost (com.cloud.hypervisor.vmware.mo.VmwareHypervisorHost)34 SSOException (com.iplanet.sso.SSOException)32 AMException (com.iplanet.am.sdk.AMException)31 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)29 AMEntryExistsException (com.iplanet.am.sdk.AMEntryExistsException)29 AMEventManagerException (com.iplanet.am.sdk.AMEventManagerException)29 LocateRegistry (java.rmi.registry.LocateRegistry)29 Registry (java.rmi.registry.Registry)29 UnsupportedEncodingException (java.io.UnsupportedEncodingException)27 EJBException (javax.ejb.EJBException)25 VirtualMachineMO (com.cloud.hypervisor.vmware.mo.VirtualMachineMO)24 ManagedObjectReference (com.vmware.vim25.ManagedObjectReference)24 ArrayList (java.util.ArrayList)22 InvocationTargetException (java.lang.reflect.InvocationTargetException)21 ConnectException (java.net.ConnectException)20 DatastoreMO (com.cloud.hypervisor.vmware.mo.DatastoreMO)18 ExecutionException (com.cloud.utils.exception.ExecutionException)18