tyrus
  1. tyrus
  2. TYRUS-157

Submitting tasks to an injected ManagedExecutorService in a ServerEndpoint does not work

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.3
    • Component/s: None
    • Labels:
      None
    • Environment:

      Glassfish 4 build 81

      Description

      To replicate the issue, inject a ManagedExecutorService inside a ServerEndpoint.

      • Using InitialContext:

      InitialContext ic = new InitialContext();
      ManagedExecutorService mes = (ManagedExecutorService) ic.lookup("java:comp/DefaultManagedExecutorService");

      • Using @Resource:

      @Resource(lookup = "concurrent/__defaultManagedExecutorService")
      ManagedExecutorService mes;

      The MES is injected correctly (no null pointer). Inside one of the annotated methods, such as @OnOpen, submit a task to the MES. The task does not run:

      mes.execute(new Runnable() {
      @Override
      public void run()

      { logger.log(Level.INFO, "runnnningEEEEE333443"); }

      });

        Activity

        Hide
        Pavel Bucek added a comment -

        How is this Tyrus issue?

        I'm going to move it to glassfish if I won't hear back from you.

        Show
        Pavel Bucek added a comment - How is this Tyrus issue? I'm going to move it to glassfish if I won't hear back from you.
        Hide
        rcervera added a comment -

        This use case works fine in a Servlet, but it does not in a WebSocket Endpoint. So the Endpoint is doing something different here. That's why I submitted this Tyrus issue.

        Please move the issue where appropriate if it is not a Tyrus issue.

        The use case is important from an application developer's point of view: it is likely that developers need to process tasks asynchronously when creating scalable WebSocket applications.

        Thanks,

        Show
        rcervera added a comment - This use case works fine in a Servlet, but it does not in a WebSocket Endpoint. So the Endpoint is doing something different here. That's why I submitted this Tyrus issue. Please move the issue where appropriate if it is not a Tyrus issue. The use case is important from an application developer's point of view: it is likely that developers need to process tasks asynchronously when creating scalable WebSocket applications. Thanks,
        Hide
        Pavel Bucek added a comment -

        thanks for clarification.. now it finally looks like it is on our side.

        Show
        Pavel Bucek added a comment - thanks for clarification.. now it finally looks like it is on our side.
        Hide
        Pavel Bucek added a comment -

        verified that it works with Tyrus 1.3 and Glassfish trunk.

        Show
        Pavel Bucek added a comment - verified that it works with Tyrus 1.3 and Glassfish trunk.

          People

          • Assignee:
            Pavel Bucek
            Reporter:
            rcervera
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: