users@grizzly.java.net

Re: ProtocolParser implementation II

From: Ken--_at_newsgroupstats.hk <dragonken_at_gmail.com>
Date: Fri, 16 May 2008 23:40:50 -0700 (PDT)

Thanks!

another question:

Can I singleton MyProtocolParser so that I am not required to create a new
instance of MyProtocolParser at ProtocolFiter?


    private MyProtocolParser() {
    }
    
    private static MyProtocolParser instance = new MyProtocolParser();
    
    public static MyProtocolParser getInstance() {return instance;};


// MyParserProtocolFilter
public class MyParserProtocolFilter extends ParserProtocolFilter {
    
    /**
     * Creates a new instance of MyParserProtocolFilter
     */
    public MyParserProtocolFilter() {
    }
    
    public ProtocolParser newProtocolParser() {
        return MyProtocolParser.getInstance();
    }
}

-- 
View this message in context: http://www.nabble.com/ProtocolParser-implementation-II-tp17152654p17288676.html
Sent from the Grizzly - Users mailing list archive at Nabble.com.