@Override protected Class<Object> _interfaceClass() { // this never supposed to be called; throw new NotImplementedException("_interfaceClass() is not implemented"); } }
public Task<?> invoke(T target, int methodId, Object[] params) { throw new MethodNotFoundException(target + " MethodId :" + methodId); }
@Override public void acquire() { try { super.acquire(); } catch (InterruptedException e) { throw new UncheckedException(e); } }
@Override public void acquire(final int permits) { try { super.acquire(permits); } catch (InterruptedException e) { throw new UncheckedException(e); } }
@Override public <T> AsyncStream<T> getStream(final String provider, final Class<T> dataClass, final String id) { throw new NotImplementedException("getStream"); }
public Method getMethod(final int methodId) { throw new MethodNotFoundException("MethodId :" + methodId); }
public void acquire(final long timeout, final TimeUnit unit) { try { if (!super.tryAcquire(timeout, unit)) { throw new UncheckedException("timeout"); } } catch (InterruptedException e) { throw new UncheckedException(e); } }
@Override public <R> Task<R> run(final TaskFunction<LocalObjects.LocalObjectEntry<T>, R> function) { throw new NotImplementedException(); }
@Override public boolean tryAcquire(final long timeout, final TimeUnit unit) { try { return super.tryAcquire(timeout, unit); } catch (InterruptedException e) { throw new UncheckedException(e); } }
@Override public int generateIdForMethod(final Annotation annotation, final String methodSignature) { // TODO: return ((MethodId) annotation).value(); throw new NotImplementedException("generateIdForMethod"); }
@Override public <T> T newInstance(final Class<T> concreteClass) { try { return concreteClass.newInstance(); } catch (Exception ex) { throw new UncheckedException(ex); } } }
@Override public int generateIdForField(final Annotation annotation, final String fieldSignature) { // TODO: return ((FieldId) annotation).value(); throw new NotImplementedException("generateIdForField"); } }
@Override public boolean tryAcquire(final int permits, final long timeout, final TimeUnit unit) { try { return super.tryAcquire(permits, timeout, unit); } catch (InterruptedException e) { throw new UncheckedException(e); } } }
@Override public T createReference(final String id) { try { return referenceConstructor.newInstance(id); } catch (final Exception e) { throw new UncheckedException(e); } } }
public static int findFreePort() { try (ServerSocket socket1 = new ServerSocket(0)) { return socket1.getLocalPort(); } catch (IOException e) { throw new UncheckedException("Error trying to find a free port", e); } }
private ClusterPeer constructDefaultClusterPeer() { try { final Class jGroupsClusterPeer = Class.forName("cloud.orbit.actors.cluster.JGroupsClusterPeer"); return (ClusterPeer) jGroupsClusterPeer.getConstructors()[0].newInstance(); } catch(Exception e) { throw new UncheckedException(e); } }
public T newInstance() { try { return getClazz().newInstance(); } catch (Exception e) { throw new UncheckedException(e); } }
public ObjectInvoker<Object> getInvokerFor(final Class<?> concreteClass) { try { final Class<?> aClass = makeInvokerClass(concreteClass, concreteClass.getName() + "$ObjectInvoker"); return (ObjectInvoker<Object>) aClass.newInstance(); } catch (final Exception e) { throw new UncheckedException(e); } }
void addContextBefore(DefaultHandlerContext base, DefaultHandlerContext newContext) { if (base == head) { base = head.outbound; } newContext.inbound = base.inbound; newContext.outbound = base; base.inbound.outbound = newContext; base.inbound = newContext; try { newContext.handler.onRegistered(newContext); } catch (Exception e) { throw new UncheckedException(e); } }
@SuppressWarnings("unchecked") public static <T extends Actor> T ref(int interfaceId, String id) { final Class classById = instance.findClassById(interfaceId); if (classById == null) { throw new UncheckedException("Class not found, id: " + interfaceId); } return (T) ref(classById, id); }