I enabled the "SNOOP" configuration (under Transports -> tcp) on the admin webpage to see what grizzly is doing under the hood. As soon as I applied the changes, the below was printed in server.log . From the log, I fail to understand why Grizzly initializes it configuration again on changing just one parameter (that too SNOOP). The way I interpret that Grizzly has initialized itself is by the following line written in the server.log. Is this just bad logging or something I am interpreting incorrectly. Why would the framework create the HTTP listener again just on change of one parameter.
WEB0169: Created **HTTP listener** [http-listener-1] on host/port
Full log below
[#|2015-06-09T15:10:01.189+0530|INFO|glassfish3.1.1|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=62;_ThreadName=pool-78-thread-1;|WEB0169: Created HTTP listener [http-listener-1] on host/port [0.0.0.0:8080]|#]
[#|2015-06-09T15:10:01.202+0530|INFO|glassfish3.1.1|javax.enterprise.system.core.com.sun.enterprise.v3.services.impl|_ThreadID=63;_ThreadName=Grizzly-kernel-thread(1);|Grizzly Framework 1.9.36 started in: 6ms - bound to [0.0.0.0:8080]|#]
[#|2015-06-09T15:10:01.981+0530|INFO|glassfish3.1.1|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=62;_ThreadName=pool-78-thread-1;|WEB0169: Created HTTP listener [http-listener-2] on host/port [0.0.0.0:8181]|#]
[#|2015-06-09T15:10:02.003+0530|INFO|glassfish3.1.1|javax.enterprise.system.core.com.sun.enterprise.v3.services.impl|_ThreadID=64;_ThreadName=Grizzly-kernel-thread(1);|Grizzly Framework 1.9.36 started in: 5ms - bound to [0.0.0.0:8181]|#]
[#|2015-06-09T15:10:02.313+0530|INFO|glassfish3.1.1|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=62;_ThreadName=pool-78-thread-1;|WEB0169: Created HTTP listener [http-download-listener-1] on host/port [0.0.0.0:8585]|#]
[#|2015-06-09T15:10:02.329+0530|INFO|glassfish3.1.1|javax.enterprise.system.core.com.sun.enterprise.v3.services.impl|_ThreadID=65;_ThreadName=Grizzly-kernel-thread(1);|Grizzly Framework 1.9.36 started in: 5ms - bound to [0.0.0.0:8085]|#]
[#|2015-06-09T15:10:03.250+0530|INFO|glassfish3.1.1|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=62;_ThreadName=pool-78-thread-1;|WEB0169: Created HTTP listener [http-listener-1] on host/port [0.0.0.0:8080]|#]
[#|2015-06-09T15:10:03.259+0530|INFO|glassfish3.1.1|javax.enterprise.system.core.com.sun.enterprise.v3.services.impl|_ThreadID=66;_ThreadName=Grizzly-kernel-thread(1);|Grizzly Framework 1.9.36 started in: 3ms - bound to [0.0.0.0:8080]|#]
[#|2015-06-09T15:10:04.018+0530|INFO|glassfish3.1.1|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=62;_ThreadName=pool-78-thread-1;|WEB0169: Created HTTP listener [http-listener-2] on host/port [0.0.0.0:8181]|#]
[#|2015-06-09T15:10:04.035+0530|INFO|glassfish3.1.1|javax.enterprise.system.core.com.sun.enterprise.v3.services.impl|_ThreadID=67;_ThreadName=Grizzly-kernel-thread(1);|Grizzly Framework 1.9.36 started in: 4ms - bound to [0.0.0.0:8181]|#]
[#|2015-06-09T15:10:04.342+0530|INFO|glassfish3.1.1|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=62;_ThreadName=pool-78-thread-1;|WEB0169: Created HTTP listener [http-download-listener-1] on host/port [0.0.0.0:8585]|#]
[#|2015-06-09T15:10:04.355+0530|INFO|glassfish3.1.1|javax.enterprise.system.core.com.sun.enterprise.v3.services.impl|_ThreadID=68;_ThreadName=Grizzly-kernel-thread(1);|Grizzly Framework 1.9.36 started in: 2ms - bound to [0.0.0.0:8585]|#]
Potential change to a transport may impact all http-listeners running on top of the transport.
Related
I have built a chrome extension that listens for specific requests going to our server.
This has been achieved by:
- Adding a listener: chrome.webRequest.onBeforeSendHeaders.addListener(function(request)
- checking the request.type
- checking the request.url
Everything works as it should, but I'm not currently able to get the requests being fired through a service worker, because the request.url doesn't match the expected one.
What should I amend in order to look at the correct parameter?
Is there another method/function to be used for service workers?
I am trying to get a port's status in an application (not a content script). When I do :
this.port = chrome.runtime.connect("okcbadfdlhldjgkbafhnkcpofabckgde");
I get a valid port object but I can't find anyway to determine if the port can be used at all (I don't even get a disconnect event if the extension can't be reached).
The only way I figured out to have the connectivity state is to actually trap an exception when performing a this.port.postMessage.
Is there a better way ?
https://developer.chrome.com/extensions/runtime#method-connect
Update
Running Version 48.0.2564.97 (64-bit) on Linux Ubuntu
No cross-extension messaging, just application to/from extension
Extension source code but note I have since moved on to implement another strategy for the extension because of the issue raised in this question.
Your extension uses a background-script that provides listener function for the chrome.runtime.onMessageExternal event. This event is used to listen for incoming messages, send from external webpage-scripts (or other extensions) by calling the chrome.runtime.sendMessage method.
Since your extension does not provide a listener function for the chrome.runtime.onConnectExternal event, chrome.runtime.connect cannot work for your extension.
As far as knowing the connection status is concerned, in this case a simple try-catch block would do enough to know whether the extension supports port or not. If it does, you need to view the manifest corresponding to this extension - to see if a particular host is allowed to send messages or not.
I was able to send message to your extension (see the enclosed figure) by adding the following lines of code in the background-script. In addition to this, I also added the matches string for the host - www.example.org in the manifest.
chrome.runtime.onMessageExternal.addListener(
function(request, _sender, sendResponse) {
console.log(request);
...
}
);
In developing in Fi-Cloud's CEP I've been having an issue that has been happening repeatedly. As I'm trying to develop a definition to perform a task, CEP's server and Authoring Tool stop responding, although ssh is still responsive.
This issue happens as I develop. I'm using the AuthoringTool to alter the definition bit by bit and then I re-upload it to the server through the authoring tool's export feature.
To reinitiate the proton with the new definition each time I alter it, I use Google's Postman with this single operation:
-PUT (url:http://{ip}:8080/ProtonOnWebServerAdmin/resources/instances/ProtonOnWebServer)
header: 'Content-Type' : 'application/json'; body : {"action": "ChangeDefinitions","definitions-url" : "/ProtonOnWebServerAdmin/resources/definitions/Definition_Name"}
At the same time, I'm logged in with three ssh intances, one to monitor the files being created on /opt/tomcat10/sample/ and other things, and the other two to 'tail -f ' log files the definition writes to, as events are processed: one log for events recieved and another log for events detected by the EPAgent.
I'm iterating through these procedures over and over as I'm developing and eventualy CEP server and the Authoring Tool stop responding.
By "tailing" tomcat's log file (# tail -f /opt/tomcat10/logs/catalina.out) I can see that, when under these circumstances, if I attemp a:
-GET (url: http://{ip}:8080/ProtonOnWebServerAdmin/resources/instances/ProtonOnWebServer)
I get no response back and tomcat logs the following response:
11452100 [http-bio-8080-exec-167] ERROR org.apache.wink.server.internal.RequestProcessor - An unhandled exception occurred which will be propagated to the container.
java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-bio-8080-exec-167" java.lang.OutOfMemoryError: PermGen space
Ssh is still responsive and I can look at tomcat's log this way.
To get over this and continue, I exit ssh connections and restart CEP's instance in the Fi-Cloud.
Is the procedure I'm using to re-upload and re-run the definition inapropriate? Should I take a different approach to developing?
When you update a definition that the CEP is already working with, and you want the CEP engine to work with the updated definition, you need to:
Export the definition using the authoring tool export (as you did)
Stop the engine run, using REST PUT
PUT //host:8080/ProtonOnWebServerAdmin/resources/instances/ProtonOnWebServer
{"action":"ChangeState","state":"stop"}
Start the engine, using REST PUT
PUT //host:8080/ProtonOnWebServerAdmin/resources/instances/ProtonOnWebServer
{"action":"ChangeState","state":"start"}
You don't need to activate the "ChangeDefinitions" action, since it is the same definition name that the engine is already working with.
Activating "ChangeDefinitions" action, only influences the next run of the CEP, and has no influence on the current run.
This answer your question about how you should update a CEP definition.
Hope it will solve your issue.
I am developing, chat application for android using ejabberd as XMPP server. I want to send GCM push notification, when user is offline. For that I am creating new module in ejabberd, registerd offline_message_hook, but this function gets called only when somebody starts typing and finishes typing. Below are the only packets passed to this hook. Although, user receive message when he/she comes online.
Packet: {xmlelement,
"message",
[{"type",
"chat"},
{"id",
"purple7d4d0773"},
{"to",
"xxx#rakshith"}],
[{xmlelement,
"paused",
[{"xmlns",
"http://jabber.org/protocol/chatstates"}],
[]}]}
Packet: {xmlelement,
"message",
[{"type",
"chat"},
{"id",
"purple7d4d0773"},
{"to",
"xxx#rakshith"}],
[{xmlelement,
"composing",
[{"xmlns",
"http://jabber.org/protocol/chatstates"}],
[]}]}
Two things about hooks in ejabberd:
1) The callbacks are called always in order, the order is defined by the priority you specify when registering it.
2) If a callback return 'stop' it prevents the event to be propagated to the rest of the listeners on the chain.
What is happening is that the ejabberd offline module is listening in the offline_message_hook, the same than your code. It handles the message, and returns 'stop', so your code isn't executed.
(your code do receive the message for the chatstates notifications because those are ignored by the offline module, and so it don't stop the chain in those cases).
You probably wants your code to be run before the offline storage module. Just remember to not return 'stop' so the offline module has the oportunity to store the message.
I had a non-OSGi application. To convert it to OSGi, I first bundled it up and gave it a simple BundleActivator. The activator's start() started up a thread of what used to be the main() of my app (and is now a Runnable), and remembered that thread. The activator's stop() interrupted that thread, and waited for it to end (via join()), then returned. This all seemed to be working fine.
As a next step in the OSGiification process, I am now trying to use OSGi configuration management instead of the Properties-based configuration that the application used to use. So I am adding in a ManagedService in addition to the Activator.
But it's no longer clear to me how I am supposed to start and stop my application; examples that I've seen are only serving to confuse me. Specifically, here:
http://felix.apache.org/site/apache-felix-config-admin.html
They no longer seem to do any real starting of the application in BundleActivator.start(). Instead, they just register a ManagedService to receive configuration. So I'm guessing maybe I start up the app's main thread when I receive configuration, in the ManagedService? They don't show it - the ManagedService's updated() just has vague comments saying to "apply configuration from config admin" when it is passed a non-null Dictionary.
So then I look here:
http://blog.osgi.org/2010/06/how-to-use-config-admin.html
In there, it seems like maybe they're doing what I guessed. They seem to have moved the actual app from BundleActivator to ManagedService, and are dealing with starting it when updated() receives non-null configuration, stopping it first if it's already started.
But now what about when the BundleActivator's stop() gets called?
Back on the first example page that I mentioned above, they unregister the ManagedService. On the second example page, they don't show what they do.
So I'm guessing maybe unregistering the ManagedService will cause null configuration to be sent to ManagedService.updated(), at which point I can interrupte the app thread, wait for it to end, and then return?
I suspect that I'm thoroughly incorrect, but I don't know what the "real" way to do this is. Thanks in advance for any help.
BundleActivator (BA) and ManagedService (MS) are callbacks to your bundle. BundleActivator is for the active state of your bundle. BA.start is when you bundle is being started and BA.stop is when it is being stopped. MS is called to provide your bundle a configuration, if there is one, or notify you there is no configuration.
So in BA.start, you register your MS service and return. When MS is called (on some other thread), you will either receive your configuration or be told there is no configuration and you can act accordingly (start app, etc.)
Your MS can also be called at anytime to advice of the modification or deletion of your configuration and you should act accordingly (i.e. adjust your app behavior).
When you are called at BA.stop, you need to stop your app. You can unregister the MS or let the framework do it for you as part of normal bundle stop processing.