[jbossseam-issues] [JBoss JIRA] Reopened: (JBSEAM-4408) Unable to easily replace asynchronous dispatchers because of package-private methods

Reid Pinchback (JIRA) jira-events at lists.jboss.org
Wed Sep 23 15:44:49 EDT 2009


     [ https://jira.jboss.org/jira/browse/JBSEAM-4408?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Reid Pinchback reopened JBSEAM-4408:
------------------------------------



Sorry for the delay in getting back to you.  

Here is the full list of what I found needed to be public:

  TimerSchedule accessors
  CronSchedule accessors
  Asynchronous.handleException()
  AsynchronousEvent.handleException()
  AsynchronousInvocation.handleException()
  ThreadPoolDispatcher.RunnableAsynchronous

Here are the items that should be at least protected:

  Schedule constructors
  CronSchedule constructors
  TimerSchedule constructors
  AbstractDispatcher.createTimerSchedule()

Somebody could probably also make a good case that the member variables of Schedule, CronSchedule, and TimerSchedule should be protected since they aren't final and don't have mutators.  The only mechanism for setting those variables right now is through the constructors.  That is a substantial portion of the reasoning behind the recommendations above about having protected constructors.


> Unable to easily replace asynchronous dispatchers because of package-private methods
> ------------------------------------------------------------------------------------
>
>                 Key: JBSEAM-4408
>                 URL: https://jira.jboss.org/jira/browse/JBSEAM-4408
>             Project: Seam
>          Issue Type: Feature Request
>          Components: Async
>    Affects Versions: 2.1.1.GA, 2.1.2.CR1, 2.1.2.CR2, 2.1.2.GA, 2.2.0.CR1, 2.2.0.GA
>            Reporter: Reid Pinchback
>            Assignee: Norman Richards
>             Fix For: 2.2.1.CR1
>
>
> One of the benefits of Seam is that you can install your open components to replace the built-in ones provided by Seam.
> I was attempting to replace the ThreadPoolDispatcher, when I encountered something that maybe should change in the Schedule and TimerSchedule API.  Instances of those classes can be created, but the values in them cannot be accessed because their accessors are package-private.  For example:
> public class Schedule implements Serializable {
>    private Long duration;
>    ...
>    Long getDuration()
>    {
>       return duration;
>    }
>   ...
> }
> Since the member variables are private, you can't create subclasses of Schedule or TimerSchedule to get at them, and because the accessors are package-private, you can't get at them that way.  Similarly any subclass of AbstractDispatcher in a different package can't access those values for determining the appropriate values for scheduled futures.
> The only work-arounds at present are pretty grungy - either creating a subclass of TimerSchedule that keeps shadow copies of the member variables, or placing the application-specific dispatcher code in a package whose name mimics the Seam package structure.  Neither is a show-stopper, but not really a good solution for a framework that is intentionally attempting to make itself extensible.
> I'd recommend making the Schedule and TimerSchedule accessors public.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the seam-issues mailing list