From: "Noel J. Bergman" <[EMAIL PROTECTED]>
> the right place, SMTPServer.  At the same time, I discovered a problem
that
> I have effectively fixed around, but we'll all want a more elegant
solution.

A publish subscribe mechanism may be more elegant. Here is a simple one..

public class WaitForAvailability {
    // primitive type is used to provide the barrier.
    // it is changed after an object is published.
    private static boolean available = false;

    private static Object obj = null;

    public static Object get() throws InterruptedException {
        while ( !available )
            Thread.currentThread().sleep(1000);
        return obj;
    }
    public static void makeAvailable(Object publish) {
        obj = publish;
        available = true;
    }
}

Harmeet
----- Original Message -----
From: "Noel J. Bergman" <[EMAIL PROTECTED]>
To: "James-Dev Mailing List" <[EMAIL PROTECTED]>
Sent: Saturday, August 24, 2002 10:00 PM
Subject: [PATCH] Outgoing Server Name Fix


> I moved the point of initialization from the wrong place (SMTPHandler) to
> the right place, SMTPServer.  At the same time, I discovered a problem
that
> I have effectively fixed around, but we'll all want a more elegant
solution.
>
> Attached is the patch.  The affected files are:
>
> ----
>
> BaseConnectionHandler
>
> This is just a refactoring of code so that a server can ask the connection
> handler to parse the configuration and return the hello name.  It kept
that
> code in one place, rather than replicate it.
>
> ----
>
> SMTPHandler
>
> This rolls back my earlier change for setting the hello name into the
> MailetContext.  We don't want to actually rollback the CVS because Peter
> made a lot of commenting changes, too.
>
> ----
>
> SMTPServer
>
> The code for setting the hello name into the MailetContext came here, and
it
> is cleaner.
>
> I also added a comment regarding inherited lifecycle methods to save
anyone
> else the same grief I had for a bit.
>
> ----
>
> RemoteDelivery
>
> This is the one change that I don't like, but I didn't like the
alternatives
> that came immediately to mind much better.
>
> Here's the deal: the SpoolManager service is starting before the SMTP
Server
> service.  The SpoolManager loads and initializes mailet chain.
> RemoteDelivery is initializing before the SMTP Server even gets a chance
to
> start, much less set the hello name into the mailet context.
>
> The problem is that we must wait for the SMTP Service to configure before
we
> try to get the hello name, from the mailet context.  The thoughts that
came
> to mind were:
>
> (a) Wait a few seconds at the start of the delivery thread to give the
SMTP
> server time to initialize.  This works fine, but isn't guaranteed.
>
> (b) Wait for the hello name to be set.  Can't.  There is no contract to
> ensure that there will be one.
>
> (c) Query the hello name for each delivery operation.  Doesn't sit well
with
> me, either.
>
> (d) Add a method to MailetContext such that multi-threaded Mailets can ask
> the MailetContext if it has finished initializing.  The notion of
"finished"
> is not well-defined.
>
> (e) Change the initialization order ... but then the SMTP server would
have
> to wait for the SpoolManager before the SMTP hander's could be permitted
to
> start.
>
> ----
>


----------------------------------------------------------------------------
----


> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to