> From: Nicola Ken Barozzi [mailto:[EMAIL PROTECTED]
>
> Berin Loritsch wrote:
<snip/>
> > ---------------- From Me (Third Version) --------------
> >
> > interface Input
> > {
> > Transaction getNextTransaction();
> > }
> >
> > interface Output
> > {
> > Response process( Transaction trans );
> > }
> >
> > interface Manipulator
> > {
> > Transaction manipulate( Transaction trans );
> > }
> >
> > ----------------- NOTES -------------------
>
> First not from me... at a first glance I don't get it...
> ...thinking... ...but it seems that you have solved the
> threadsafe problem by putting
> the extra methods needed to setup first and then execute in different
> objects... interesting...
>
> So instead of having one object with three methods to call in
> order, we
> have three objects each with an atomic method.
Yes. Think of the Job as the MorphPipeline so to speak. It forwards
stuff on to the next stage.
>
> I'm still not sure if this is clever or just illusionism 8-)
> but still
> thinking...
Here is the processing loop in code:
---------------------------------------------------------------------
Transaction transaction = null;
while ( ( transaction = m_input.getNextTransaction() ) != null )
{
Iterator it = m_manipulators.iterator();
while ( it.hasNext() )
{
Manipulator manipulator = (Manipulator) it.next();
transaction = manipulator.process( transaction );
if ( ! transaction.isSuccessful() )
{
m_notifier.notify( transaction.getResponse() );
break;
}
}
if ( transaction.isSuccessful() )
{
m_notifier.notify( m_output.process( transaction ) );
}
}
---------------------------------------------------------------------
Another alternative is to have the Input return a TransactionIterator
or something like that.
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>