Package com.sun.sgs.app

Examples of com.sun.sgs.app.ManagedObject


     * @param  key a key
     * @param  value a value
     */
    private static void putKeyValue(String bindingName, Object value) {
  assert value != null && value instanceof Serializable;
  ManagedObject v =
      value instanceof ManagedObject ?
      (ManagedObject) value :
      new Wrapper<Object>(value);
  BindingKeyedCollectionsImpl.getDataService().
      setServiceBinding(bindingName, v);
View Full Code Here


     * Returns the value associated with the specified {@code bindingName}.
     * removing the wrapper if applicable.
     */
    @SuppressWarnings("unchecked")
    private V getValue(String bindingName) {
  ManagedObject v =
      BindingKeyedCollectionsImpl.getDataService().
          getServiceBinding(bindingName);
  return
      v instanceof Wrapper ?
      (V) ((Wrapper) v).get() :
View Full Code Here

  try {
      if (name == null) {
    throw new NullPointerException("The name must not be null");
      }
      context = getContext();
      ManagedObject result;
      try {
    result = context.getBinding(
        getInternalName(name, serviceBinding), forUpdate);
      } catch (NameNotBoundException e) {
    throw new NameNotBoundException(
View Full Code Here

      dataService = BindingKeyedCollectionsImpl.getDataService();
  }
 
  @SuppressWarnings("unchecked")
  private V getValue(String bindingName) {
      ManagedObject v = dataService.getServiceBinding(bindingName);
      return
    v instanceof Wrapper ?
    (V) ((Wrapper) v).get() :
    (V) v;
  }
View Full Code Here

  }
 
  @SuppressWarnings("unchecked")
  private V getValue(String bindingName) {
      try {
    ManagedObject v = BindingKeyedCollectionsImpl.getDataService().
        getServiceBinding(bindingName);
    return
        v instanceof Wrapper ?
        (V) ((Wrapper) v).get() :
        (V) v;
View Full Code Here

   * null listener, or the application removed the
   * ClientSessionListener object from the data service.
   */
  ClientSessionListener listener = null;
  try {
      ManagedObject obj = null;
      try {
    obj = dataService.getServiceBinding(listenerKey);
      } catch (ObjectNotFoundException ignore) {
    // listener already removed
      }
      dataService.removeServiceBinding(listenerKey);
       if (obj instanceof ListenerWrapper) {
    dataService.removeObject(obj);
    listener = ((ListenerWrapper) obj).get();
      } else {
    listener = (ClientSessionListener) obj;
      }

  } catch (NameNotBoundException e) {
      logger.logThrow(
    Level.FINE, e,
    "removing ClientSessionListener for session:{0} throws",
    this);
  }

  /*
   * Remove event queue and associated binding.
   */
  try {
      ManagedObject eventQueue =
    dataService.getServiceBinding(eventQueueKey);
      dataService.removeServiceBinding(eventQueueKey);
      dataService.removeObject(eventQueue);
  } catch (NameNotBoundException e) {
      logger.logThrow(
View Full Code Here

     *     current transaction
     */
    void putClientSessionListener(
  DataService dataService, ClientSessionListener listener)
    {
  ManagedObject managedObject =
      (listener instanceof ManagedObject) ?
      (ManagedObject) listener :
      new ListenerWrapper(listener);
  String listenerKey = getListenerKey();
  // TBD: this could use a BindingKeyedMap.
View Full Code Here

     * @throws  TransactionException if there is a problem with the
     *     current transaction
     */
    ClientSessionListener getClientSessionListener(DataService dataService) {
  String listenerKey = getListenerKey();
  ManagedObject obj = dataService.getServiceBinding(listenerKey);
  return
      (obj instanceof ListenerWrapper) ?
      ((ListenerWrapper) obj).get() :
      (ClientSessionListener) obj;
    }
View Full Code Here

        assertTrue(setObjects <= proxy.getSetObjectsCalls());

        // Test one of the APIs by calling through the data service
        txnScheduler.runTask(new TestAbstractKernelRunnable() {
    public void run() {
                    ManagedObject dummy = new DummyManagedObject();
                    serverNode.getDataService().setBinding("dummy", dummy);
    }}, taskOwner);
        // Should certainly be greater number, not greater or equal
        assertTrue(createObject < proxy.getCreateObjectCalls());
        assertTrue(writtenBytes < proxy.getWrittenBytesCount());
View Full Code Here

        assertTrue(setServiceBinding <= proxy.getSetServiceBindingCalls());
       
        // Test one of the APIs
        txnScheduler.runTask(new TestAbstractKernelRunnable() {
    public void run() {
                    ManagedObject dummy = new DummyManagedObject();
                    serverNode.getDataService().setBinding("dummy", dummy);
    }}, taskOwner);
        // Should certainly be greater number, not greater or equal
        assertTrue(setBinding < proxy.getSetBindingCalls());
        assertTrue(setBinding < bean.getSetBindingCalls());
View Full Code Here

TOP

Related Classes of com.sun.sgs.app.ManagedObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.