public T getTarget() { return cmiReferenceable.getReferencedObject(); }
@Override public boolean equals(final Object obj) { if(obj == null || !(obj instanceof CMIReferenceable)) { return false; } return cmiRef.equals(((CMIReferenceable<?>) obj).getReference()); }
cmiReference = currentRef.getReference(); cmiReferenceable = currentRef; long timeBefore = System.currentTimeMillis(); try { result = method.invoke(cmiReferenceable.getReferencedObject(), args); long timeAfter = System.currentTimeMillis(); lastInvocDuration = timeAfter - timeBefore;
public Object proceed() throws Exception { return method.invoke(cmiReferenceable.getReferencedObject(), parameters); }
/** * Checks if the given object with the given clue is matching. * @param cmiReferenceable given object against which the check should be done. * @param cmiReference the object used as clue to check the matching. * @return true if it is matching, else false. */ public boolean isMatching(final CMIReferenceable<?> cmiReferenceable, final CMIReference cmiReference) { LOGGER.debug("{0} == {1} ?", cmiReferenceable.getReference(), cmiReference); return cmiReferenceable.getReference().equals(cmiReference); }
/** * Creates an instance of CMIReferenceable with the given hint. * @param cmiReference a clue given by the Pool. Could be null. * @throws PoolException if instance cannot be created. * @return the created instance. */ public CMIReferenceable<?> create(final CMIReference cmiReference) throws PoolException { CMIReferenceable<?> stubOrProxy; try { stubOrProxy = StubOrProxyHelper.download(clusterViewManager, cmiReference); } catch (ProtocolNotFoundException e) { LOGGER.error("Cannot get a CMIReferenceable for " + cmiReference, e); throw new PoolException("Cannot get a CMIReferenceable for " + cmiReference, e); } catch (ObjectNotFoundException e) { LOGGER.error("Cannot get a CMIReferenceable for " + cmiReference, e); throw new PoolException("Cannot get a CMIReferenceable for " + cmiReference, e); } catch (NamingException e) { LOGGER.debug("No CMIReferenceable is bound for " + cmiReference, e); throw new NamingPoolException( "No CMIReferenceable is bound for " + cmiReference, e); } if (expectedType != null && !expectedType.isAssignableFrom(stubOrProxy.getReferencedObject().getClass())) { LOGGER.error("Unexpected type! Required: {0} - Found: {1}", expectedType.getName(), stubOrProxy.getReferencedObject().getClass().getName()); throw new PoolException("Unexpected type! Required: " + expectedType.getName() + " - Found: " + stubOrProxy.getReferencedObject().getClass().getName()); } LOGGER.debug("Adding a new stub/proxy for {0}: {1}", cmiReference, stubOrProxy); return stubOrProxy; }
public boolean isMatching(final CMIReferenceable<?> object, final CMIReference clue) { LOGGER.debug("{0} == {1} ?", object.getReference(), clue); return object.getReference().equals(clue); }
arguments = new Object[] {remoteStubWrapped.getReferencedObject().getPrimaryKey()};
/** * Return a stub of {@link EJBObject} wrapped with its CMIReference. * @param proxy a CMI proxy * @param method a create (or find) method * @param args method arguments * @return a wrapper containing a stub of EJBObject and its CMIReference * @throws Throwable if the stub cannot be downloaded */ public CMIReferenceableWrapper<EJBObject> getWrappedEJBObject( final Object proxy, final Method method, final Object... args) throws Throwable { // Get a stub of EJBObject EJBObject ejbObject = (EJBObject) super.invokeRemoteMethod(proxy, method, args); // Wrap it with its associated CMIReference return new CMIReferenceableWrapper<EJBObject>(getCurrentRef().getReference(), ejbObject); }