Package com.sun.sgs.app

Examples of com.sun.sgs.app.ManagedObject


                DataServiceMXBean.class);
       
        // Test that consumer level can be changed
        txnScheduler.runTask(new TestAbstractKernelRunnable() {
    public void run() {
                    ManagedObject dummy = new DummyManagedObject();
                    serverNode.getDataService().setBinding("dummy", dummy);
    }}, taskOwner);
        assertEquals(0, dataProxy.getSetBindingCalls());
       
        proxy.setConsumerLevel(consName, ProfileLevel.MAX);
        assertEquals(ProfileLevel.MAX, proxy.getConsumerLevel(consName));
       
        txnScheduler.runTask(new TestAbstractKernelRunnable() {
    public void run() {
                    ManagedObject dummy = new DummyManagedObject();
                    serverNode.getDataService().setBinding("dummy", dummy);
    }}, taskOwner);
        assertTrue(dataProxy.getSetBindingCalls() > 0);
    }
View Full Code Here


    /** Obtains the object associated with the specified internal name. */
    ManagedObject getBinding(String internalName, boolean forUpdate) {
  long id = store.getBinding(txn, internalName);
  assert id >= 0 : "Object ID must not be negative";
  ManagedObject result;
  if (forUpdate) {
      result = (ManagedObject) getReference(id).getForUpdate(false);
  } else {
      result = (ManagedObject) getReference(id).get(false);
  }
View Full Code Here

    /** Adds a new managed reference to this table. */
    void add(ManagedReferenceImpl<?> ref) {
  assert !oids.containsKey(ref.oid)
      : "Found existing reference for oid:" + ref.oid;
  oids.put(ref.oid, ref);
  ManagedObject object = ref.getObject();
  if (object != null) {
      assert !objects.containsKey(object)
    : "Found existing reference for object with oid:" + ref.oid;
      objects.put(object, ref);
  }
View Full Code Here

    /** Removes a managed reference from this table. */
    void remove(ManagedReferenceImpl<?> ref) {
  Object existing = oids.remove(ref.oid);
  assert existing == ref
      : "Found duplicate reference for oid:" + ref.oid;
  ManagedObject object = ref.getObject();
  if (object != null) {
      existing = objects.remove(object);
      assert existing == ref
    : "Found duplicate reference for oid:" + ref.oid;
  }
View Full Code Here

  testSetBindingNotSerializable(false);
    }
    private void testSetBindingNotSerializable(final boolean app)
        throws Exception
    {
  final ManagedObject mo = new ManagedObject() { };
        txnScheduler.runTask(new InitialTestRunnable() {
            public void run() throws Exception {
                super.run();
                try {
                    setBinding(app, service, "dummy", mo);
View Full Code Here

    @Test
    public void testRemoveObjectNotSerializable() throws Exception {
        txnScheduler.runTask(new InitialTestRunnable() {
            public void run() throws Exception {
                super.run();
                ManagedObject mo = new ManagedObject() { };
                try {
                    service.removeObject(mo);
                    fail("Expected IllegalArgumentException");
                } catch (IllegalArgumentException e) {
                    System.err.println(e);
View Full Code Here

    @Test
    public void testMarkForUpdateNotSerializable() throws Exception {
        txnScheduler.runTask(new InitialTestRunnable() {
            public void run() throws Exception {
                super.run();
                ManagedObject mo = new ManagedObject() { };
                try {
                    service.markForUpdate(mo);
                    fail("Expected IllegalArgumentException");
                } catch (IllegalArgumentException e) {
                    System.err.println(e);
View Full Code Here

    @Test
    public void testCreateReferenceNotSerializable() throws Exception {
        txnScheduler.runTask(new TestAbstractKernelRunnable() {
            public void run() {
                ManagedObject mo = new ManagedObject() { };
                try {
                    service.createReference(mo);
                    fail("Expected IllegalArgumentException");
                } catch (IllegalArgumentException e) {
                    System.err.println(e);
View Full Code Here

    @Test
    public void testGetObjectIdNotSerializable() throws Exception {
        txnScheduler.runTask(new TestAbstractKernelRunnable() {
            public void run() {
                ManagedObject mo = new ManagedObject() { };
                try {
                    service.getObjectId(mo);
                    fail("Expected IllegalArgumentException");
                } catch (IllegalArgumentException e) {
                    System.err.println(e);
View Full Code Here

         *
         * @return the {@code AppListener} for the application
         */
        @SuppressWarnings("unchecked")
        private AppListener getAppListener() {
            ManagedObject obj = dataService.getServiceBinding(
                    StandardProperties.APP_LISTENER);
            return (obj instanceof AppListener) ?
                (AppListener) obj :
                ((ManagedSerializable<AppListener>) obj).get();
        }
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.