overview new features.

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

overview new features.

Peter Veentjer - Anchor Men
Does anyone have a good overview of the new concurrency features of Java 6? I`m quite interested what is comming next.
 
At the moment I`m happy with the concurrency library (have made some Spring beans so that it can be integrated in Spring better). But there are some parts where the concurrency library could be improved. One of those things would be better control on timeout behaviour of the executorservices. That is why I have created the BlockingExecutor that gives the control.
 
public interface BlockingExecutor {
 /**
  * @param command the command to execute.
  * @throws InterruptedException if the current thread has been interrupted. If that happens,
  *                              the command is not executed.
  * @throws NullPointerException if command is null.
  */
 void put(Runnable command) throws InterruptedException;

 /**
  * Offers a command to this BlockingExecutor.
  *
  * @param command the command to execute.
  * @param timeout how long to wait before giving up, in units of unit
  * @param unit    a TimeUnit determining how to interpret the timeout parameter
  * @return true if successful, or false if the specified waiting time elapses before space is available.
  * @throws InterruptedException if the current thread has been interrupted. If that happens,
  *                              the command is not executed.
  * @throws NullPointerException if command or unit is null.
  */
 boolean offer(Runnable command, long timeout, TimeUnit unit) throws InterruptedException;
}
 
Maybe this would be a nice addition to the concurrency library.
 
And why where the Takeable/Puttable/Channel interfaces/implementations removed? I had to create my own libary based on those interfaces and I think the original code should have made it into java 5. JMS is too heavy... and the removed code was perfect.

_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|

Re: overview new features.

tpeierls
Peter Veentjer - Anchor Men wrote:
> Does anyone have a good overview of the new concurrency features of Java 6?
> I`m quite interested what is comming next.

You can browse the JSR166 maintenance updates docs, see the Concurrency JSR166
Interest Site -- http://gee.cs.oswego.edu/dl/concurrency-interest/index.html
-- for details, particularly

  http://gee.cs.oswego.edu/dl/concurrency-interest/post-tiger.html


>  ... But there are some
> parts where the concurrency library could be improved. One of those things
> would be better control on timeout behaviour of the executorservices. That
> is why I have created the BlockingExecutor that gives the control.
>
> public interface BlockingExecutor {
>  void put(Runnable command) throws InterruptedException;
>  boolean offer(Runnable command, long timeout, TimeUnit unit) throws InterruptedException;
> }

Do you have a small example that illustrates the use of BlockingExecutor to do
something that is difficult or impossible to achieve conveniently with the
standard task execution framework?


> And why where the Takeable/Puttable/Channel interfaces/implementations
> removed? I had to create my own libary based on those interfaces and I
> think the original code should have made it into java 5. JMS is too
> heavy... and the removed code was perfect.

The method names haven't changed, only the class name.

  Channel -> BlockingQueue
  Takeable -> the take and poll methods of BlockingQueue
  Puttable -> the put and offer methods of BlockingQueue

There are no separate interfaces to describe the puttable side of a
BlockingQueue from its takeable side, but you can provide simple wrappers to
achieve the same effect.

--tim

_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest