2016-07-23 8 views
0

着信要求の数をカウントすることから始めて、ジャージーサーバーを監視したいと考えています。ジャージーサーバーの監視

私はここからの公式ガイド次午前:私は、アプリケーションイベントリスナーと要求イベントリスナーの概念を理解https://jersey.java.net/documentation/latest/monitoring_tracing.html

。しかし、私はアプリケーションイベントリスナーの登録の概念を理解していません。私の質問は(MyApplicationEventListenerまたは別のクラスで)次のコードをどこに置くかである:

ResourceConfig resourceConfig = 
     new ResourceConfig(TestResource.class, MyApplicationEventListener.class) 
     .setApplicationName("my-monitored-application"); 

コードのこの作品のために同じ質問:

target.path("resource").request() 
    .post(Entity.entity("post", MediaType.TEXT_PLAIN_TYPE)); 
target.path("resource").request().get(); 

あなたが表示することができた場合完全なJavaプロジェクトであれば、私とこの質問の答えを探している他の人にとっては完璧です。

ありがとうございました。

答えて

0

このように使用できると思います。

@Configuration 
public class EndpointsConfig extends ResourceConfig { 
    /** 
    * Configures all necessary features, endpoints and properties. 
    */ 
    public EndpointsConfig() throws UnknownHostException { 
    // register features 
     register(MyApplicationEventListener.class); 
    } 
} 
+0

私はあなたのコードを試しましたが、何もしません:) –