users@glassfish.java.net

throttle webservice in glassfish possible?

From: <glassfish_at_javadesktop.org>
Date: Wed, 13 May 2009 00:40:07 PDT

hi *,

i have just created my first gf webservice by doing the attached code.
is there any possibility to limit the number of concurrent calls on this webservice to e.g. 30? i would like to have a throttle mechanism here. or do i have to implement this myself?

regards chris


CODE:
@WebService()
@Stateless()
public class NewWebService {

    /**
     * Web service operation
     */
    @WebMethod(operationName = "operation")
    public String operation(@WebParam(name = "parameter") String parameter) {
        //TODO write your implementation code here:
       String sent = "sent";
        com.stc.connectors.jms.JMS jms = com.stc.connectors.jms.JMS.createInstance(_jms_connfact, _notx_jms_connfact, com.stc.connectors.jms.JMS.DestinationType.Queue, "someQueueNameFromJCA", true, javax.jms.DeliveryMode.PERSISTENT, 0);
        Message msg = jms.createBytesMessage();
        msg.setBytesMessage("hello".getBytes());
        try {
            jms.send(msg);
        } catch (JMSException ex) {
            Logger.getLogger(NewWebService.class.getName()).log(Level.SEVERE, "could not send message", ex);
            sent = "not sent";
        }
        return sent;
    }
    // <editor-fold defaultstate="collapsed" desc="_jms_connfact resource declaration. Click on the + sign on the left to edit the code.">
    @javax.annotation.Resource(name = "jms/myJms")
    private javax.jms.ConnectionFactory _jms_connfact; // </editor-fold>
    // <editor-fold defaultstate="collapsed" desc="_notx_jms_connfact resource declaration. Click on the + sign on the left to edit the code.">
    @javax.annotation.Resource(name = "jms/myJms")
    private javax.jms.ConnectionFactory _notx_jms_connfact; // </editor-fold>

}
[Message sent by forum member 'eingfoan' (eingfoan)]

http://forums.java.net/jive/thread.jspa?messageID=346056