Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4336289

BeanContextServicesSupport spec is unclear

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      generic, sparc
    • OS:
      generic, solaris_2.6

      Description



      Name: ooR10001 Date: 05/06/2000



      java.beans.beancontext.BeanContextServicesSupport doc is unclear.
      There is no description how readObject() and writeObject() methods
      must work. It causes a problem when creating serialized tests - it is
      unclear how to correctly write object to a stream or create stream for
      deserialization.

      The javadoc says:


       Class java.beans.beancontext.BeanContextServicesSupport implements
       Serializable


       Serialization Methods


      readObject

      private void readObject(ObjectInputStream ois)
                       throws IOException,
                              ClassNotFoundException

            deserialize the instance



      writeObject

      private void writeObject(ObjectOutputStream oos)
                        throws IOException

            serialize the instance
      -------------------------------------------------------------
      ======================================================================

      Name: yyT116575 Date: 10/17/2000


      java version "1.3.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
      Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)

      In the following code there's a TooManyListeners exception which shouldn't be there IMHO.


      =======================
            BeanContextServicesSupport c1 = new BeanContextServicesSupport();
            BeanContextServicesSupport c2 = new BeanContextServicesSupport();
            BeanContextChildSupport c3 = new BeanContextChildSupport();

            c1.add(c2);
            c2.add(c3);

            final Integer integer = new Integer(1);
            final String string = "Hello";

            c1.addService(
              String.class,
              new BeanContextServiceProvider()
              {
                public Object getService(BeanContextServices bcs, Object requestor,
      Class serviceClass, Object serviceSelector)
                {
                  return string;
                }
                public void releaseService(BeanContextServices bcs, Object requestor,
      Object service){}
                public Iterator getCurrentServiceSelectors(BeanContextServices bcs,
      Class serviceClass){return null;}
              });

            c1.addService(
              Integer.class,
              new BeanContextServiceProvider()
              {
                public Object getService(BeanContextServices bcs, Object requestor,
      Class serviceClass, Object serviceSelector)
                {
                  return integer;
                }
                public void releaseService(BeanContextServices bcs, Object requestor, Object service){}
                public Iterator getCurrentServiceSelectors(BeanContextServices bcs,Class serviceClass)
      {return null;}
              });

            Object s = c2.getService(c3, c3, Integer.class, null, new BeanContextServiceRevokedListener()
            {
              public void serviceRevoked(BeanContextServiceRevokedEvent bcsre){}
            });

            for (int i = 0; i < 100; i++)
            {
              Object o = c2.getService(c3, c3, String.class, null, new BeanContextServiceRevokedListener()
              {
                public void serviceRevoked(BeanContextServiceRevokedEvent bcsre){}
              });

              c2.releaseService(c3, c3, o);
            }

            c2.releaseService(c3, c3, s);
      (Review ID: 110369)
      ======================================================================

        Attachments

          Activity

            People

            Assignee:
            shommel Scott Hommel (Inactive)
            Reporter:
            oovsunw Oov Oov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: