javax.ejb.Handle类的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(8.8k)|赞(0)|评价(0)|浏览(94)

本文整理了Java中javax.ejb.Handle类的一些代码示例,展示了Handle类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Handle类的具体详情如下:
包路径:javax.ejb.Handle
类名称:Handle

Handle介绍

[英]The Handle interface is implemented by all EJB object handles. A handle is an abstraction of a network reference to an EJB object. A handle is intended to be used as a "robust" persistent reference to an EJB object.
[中]

代码示例

代码示例来源:origin: wildfly/wildfly

@Override
  public Object processInvocation(final InterceptorContext context) throws Exception {
    final Handle handle = (Handle) context.getParameters()[0];
    handle.getEJBObject().remove();
    return null;
  }
}

代码示例来源:origin: org.jboss.jbossas/jboss-as-cluster

protected Object resolveObject (Object obj)
 throws IOException
 {
   if (obj instanceof javax.ejb.Handle)
    return ((javax.ejb.Handle)obj).getEJBObject ();
   return obj;
 }
}

代码示例来源:origin: org.apache.openejb/openejb-itests-client

public void Xtest03_copyHandleBySerialize() {
  try {
    final ByteArrayOutputStream baos = new ByteArrayOutputStream();
    final ObjectOutputStream oos = new ObjectOutputStream(baos);
    oos.writeObject(ejbHandle);
    oos.flush();
    oos.close();
    final ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    final ObjectInputStream ois = new ObjectInputStream(bais);
    final Handle copy = (Handle) ois.readObject();
    final EJBObject object = copy.getEJBObject();
    assertNotNull("The EJBObject is null", object);
    assertTrue("EJBObjects are not identical", object.isIdentical(ejbObject));
  } catch (final Exception e) {
    fail("Received Exception " + e.getClass() + " : " + e.getMessage());
  }
}

代码示例来源:origin: org.jboss.jbossas/jboss-as-server

protected Object resolveObject (Object obj)
   throws IOException
 {
   if (obj instanceof javax.ejb.Handle)
    return ((javax.ejb.Handle)obj).getEJBObject ();
      return obj;
 }
}

代码示例来源:origin: org.apache.openejb/openejb-itests-client

public void Xtest03_copyHandleBySerialize() {
  try {
    final ByteArrayOutputStream baos = new ByteArrayOutputStream();
    final ObjectOutputStream oos = new ObjectOutputStream(baos);
    oos.writeObject(ejbHandle);
    oos.flush();
    oos.close();
    final ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    final ObjectInputStream ois = new ObjectInputStream(bais);
    final Handle copy = (Handle) ois.readObject();
    final EJBObject object = copy.getEJBObject();
    assertNotNull("The EJBObject is null", object);
    assertTrue("EJBObjects are not identical", object.isIdentical(ejbObject));
  } catch (final Exception e) {
    fail("Received Exception " + e.getClass() + " : " + e.getMessage());
  }
}

代码示例来源:origin: org.jboss.jbossas/jboss-as-server

protected Object resolveObject(final Object obj)
   throws IOException
 {
   if (obj instanceof Handle)
    return ((Handle)obj).getEJBObject();
    
   return obj;
 }
}

代码示例来源:origin: org.apache.geronimo.ext.openejb/openejb-itests-client

public void Xtest03_copyHandleBySerialize() {
  try {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    ObjectOutputStream oos = new ObjectOutputStream(baos);
    oos.writeObject(ejbHandle);
    oos.flush();
    oos.close();
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    ObjectInputStream ois = new ObjectInputStream(bais);
    Handle copy = (Handle) ois.readObject();
    EJBObject object = copy.getEJBObject();
    assertNotNull("The EJBObject is null", object);
    assertTrue("EJBObjects are not identical", object.isIdentical(ejbObject));
  } catch (Exception e) {
    fail("Received Exception " + e.getClass() + " : " + e.getMessage());
  }
}

代码示例来源:origin: org.jboss.ejb3/jboss-ejb3-core

protected void removeHandle(Handle arg) throws Exception
{
 /*
 StatefulHandleImpl handle = (StatefulHandleImpl) arg;
 destroySession(handle.id);
 */
 arg.getEJBObject().remove();
}

代码示例来源:origin: com.caucho/resin

/**
  * Replace with the real skeleton.
  */
 public Object readResolve()
  throws ObjectStreamException
 {
  try {
   Object obj = this.handle.getEJBObject();
   return obj;
  } catch (Exception e) {
   throw new ObjectExceptionWrapper(e);
  }
 }
}

代码示例来源:origin: org.apache.geronimo.ext.openejb/openejb-itests-client

public void Xtest03_copyHandleBySerialize() {
  try {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    ObjectOutputStream oos = new ObjectOutputStream(baos);
    oos.writeObject(ejbHandle);
    oos.flush();
    oos.close();
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    ObjectInputStream ois = new ObjectInputStream(bais);
    Handle copy = (Handle) ois.readObject();
    EJBObject object = copy.getEJBObject();
    assertNotNull("The EJBObject is null", object);
    assertTrue("EJBObjects are not identical", object.isIdentical(ejbObject));
  } catch (Exception e) {
    fail("Received Exception " + e.getClass() + " : " + e.getMessage());
  }
}

代码示例来源:origin: org.jboss.as/jboss-as-ejb3

@Override
  public Object processInvocation(final InterceptorContext context) throws Exception {
    final Handle handle = (Handle) context.getParameters()[0];
    handle.getEJBObject().remove();
    return null;
  }
}

代码示例来源:origin: org.apache.openejb/openejb-itests-client

public void test01_getEJBObject(){
  try{
    final EJBObject object = ejbHandle.getEJBObject();
    assertNotNull( "The EJBObject is null", object );
    // Wait until isIdentical is working.
    //assertTrue("EJBObjects are not identical", object.isIdentical(ejbObject));
  } catch (final Exception e){
    fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
  }
}

代码示例来源:origin: org.apache.openejb/openejb-itests-client

public void Xtest03_copyHandleBySerialize() {
  try {
    final ByteArrayOutputStream baos = new ByteArrayOutputStream();
    final ObjectOutputStream oos = new ObjectOutputStream(baos);
    oos.writeObject(ejbHandle);
    oos.flush();
    oos.close();
    final ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    final ObjectInputStream ois = new ObjectInputStream(bais);
    final Handle copy = (Handle) ois.readObject();
    final EJBObject object = copy.getEJBObject();
    assertNotNull("The EJBObject is null", object);
    assertTrue("EJBObjects are not identical", object.isIdentical(ejbObject));
  } catch (final Exception e) {
    fail("Received Exception " + e.getClass() + " : " + e.getMessage());
  }
}

代码示例来源:origin: org.jboss.as/jboss-as-ejb3

public Object processInvocation(final InterceptorContext interceptorContext) throws Exception {
    final Handle handle = (Handle) interceptorContext.getParameters()[0];
    handle.getEJBObject().remove();
    return null;
  }
};

代码示例来源:origin: org.apache.geronimo.ext.openejb/openejb-itests-client

public void test01_getEJBObject(){
  try{
    EJBObject object = ejbHandle.getEJBObject();
    assertNotNull( "The EJBObject is null", object );
    // Wait until isIdentical is working.
    //assertTrue("EJBObjects are not identical", object.isIdentical(ejbObject));
  } catch (Exception e){
    fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
  }
}

代码示例来源:origin: org.apache.geronimo.ext.openejb/openejb-itests-client

public void Xtest03_copyHandleBySerialize() {
  try {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    ObjectOutputStream oos = new ObjectOutputStream(baos);
    oos.writeObject(ejbHandle);
    oos.flush();
    oos.close();
    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
    ObjectInputStream ois = new ObjectInputStream(bais);
    Handle copy = (Handle) ois.readObject();
    EJBObject object = copy.getEJBObject();
    assertNotNull("The EJBObject is null", object);
    assertTrue("EJBObjects are not identical", object.isIdentical(ejbObject));
  } catch (Exception e) {
    fail("Received Exception " + e.getClass() + " : " + e.getMessage());
  }
}

代码示例来源:origin: org.glassfish.ejb/ejb-container

/**
 * This is the implementation of the javax.ejb.EJBHome remove method.
 * @exception RemoveException on error during removal
 */
public final void remove(Handle handle)
  throws RemoteException, RemoveException
{
  container.authorizeRemoteMethod(BaseContainer.EJBHome_remove_Handle);
  
  EJBObject ejbo;
  try {
    ejbo = handle.getEJBObject();
  } catch ( RemoteException ex ) {
    _logger.log(Level.FINE, "Exception in method remove()", ex);
    NoSuchObjectException nsoe = 
      new NoSuchObjectException(ex.toString());
    nsoe.initCause(ex);
    throw nsoe;
  }
  ejbo.remove();
}

代码示例来源:origin: org.apache.geronimo.ext.openejb/openejb-itests-client

public void test01_getEJBObject() {
  try {
    EJBObject object = ejbHandle.getEJBObject();
    assertNotNull("The EJBObject is null", object);
    // Wait until isIdentical is working.
    //assertTrue("EJBObjects are not identical", object.isIdentical(ejbObject));
  } catch (Exception e) {
    fail("Received Exception " + e.getClass() + " : " + e.getMessage());
  }
}

代码示例来源:origin: org.apache.openejb/openejb-itests-client

public void test01_getEJBObject() {
  try {
    final EJBObject object = ejbHandle.getEJBObject();
    assertNotNull("The EJBObject is null", object);
    assertTrue("EJBObjects are not identical", object.isIdentical(ejbObject));
  } catch (final Exception e) {
    fail("Received Exception " + e.getClass() + " : " + e.getMessage());
  }
}

代码示例来源:origin: org.apache.geronimo.ext.openejb/openejb-itests-client

public void test01_getEJBObject(){
  try{
    EJBObject object = ejbHandle.getEJBObject();
    assertNotNull( "The EJBObject is null", object );
    // Wait until isIdentical is working.
    //assertTrue("EJBObjects are not identical", object.isIdentical(ejbObject));
  } catch (Exception e){
    fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
  }
}
/**

相关文章

Handle类方法