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()));
}
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);
}
}
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);
}
}
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;
}
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;
}
Aggregations