What happens when a Android Service ( which is delivered as part of a .aar to multiple apps), is started by multiple apps? - android-service

I have a .aar which has a android service ( named CommonService ) packaged in it. The .aar is delivered to two apps. Each app will perform startService() on this service.
Will there be two instance of the service running ? Following logs ( taken by executing adb dumpsys activity services CommonService ) suggest that two instances are running.
If I have to restrict the instantiation of the CommonService to one, is it possible when it is being delivered as part of a .aar?
========= Dumpsys Log Start =========================
ACTIVITY MANAGER SERVICES (dumpsys activity services)
User 0 active services:
ServiceRecord{63baa27 u0 com.example.wspace1.app2withtestservice/com.example.commservice.CommonService}
intent={cmp=com.example.wspace1.app2withtestservice/com.example.commservice.CommonService VirtualScreenParam=Params{mDisplayId=-1, null, mFlags=0x00000000)}}
packageName=com.example.wspace1.app2withtestservice
processName=com.example.wspace1.app2withtestservice
baseDir=/data/app/com.example.wspace1.app2withtestservice-2/base.apk
dataDir=/data/user/0/com.example.wspace1.app2withtestservice
app=ProcessRecord{b41ccb6 15824:com.example.wspace1.app2withtestservice/u0a264}
createTime=-4m50s301ms startingBgTimeout=--
lastActivity=-4m30s679ms restartTime=-4m50s301ms createdFromFg=true
startRequested=true delayedStop=false stopIfKilled=false callStart=true lastStartId=1
Bindings:
IntentBindRecord{8e6d1a0}:
intent={cmp=com.example.wspace1.app2withtestservice/com.example.commservice.CommonService VirtualScreenParam=Params{mDisplayId=-1, null, mFlags=0x00000000)}}
binder=android.os.BinderProxy#fe63159
requested=true received=true hasBound=false doRebind=false
ServiceRecord{76b737e u0 com.example.wspace1.app1withtestservice/com.example.commservice.CommonService}
intent={cmp=com.example.wspace1.app1withtestservice/com.example.commservice.CommonService VirtualScreenParam=Params{mDisplayId=-1, null, mFlags=0x00000000)}}
packageName=com.example.wspace1.app1withtestservice
processName=com.example.wspace1.app1withtestservice
baseDir=/data/app/com.example.wspace1.app1withtestservice-1/base.apk
dataDir=/data/user/0/com.example.wspace1.app1withtestservice
app=ProcessRecord{d0352e6 11338:com.example.wspace1.app1withtestservice/u0a263}
createTime=-5m54s5ms startingBgTimeout=--
lastActivity=-5m43s845ms restartTime=-5m54s4ms createdFromFg=true
startRequested=true delayedStop=false stopIfKilled=false callStart=true lastStartId=1
Bindings:
IntentBindRecord{d8c47df}:
intent={cmp=com.example.wspace1.app1withtestservice/com.example.commservice.CommonService VirtualScreenParam=Params{mDisplayId=-1, null, mFlags=0x00000000)}}
binder=android.os.BinderProxy#81abc2c
requested=true received=true hasBound=false doRebind=false

Related

Unable to find JMS Destination in JNDI'

I am trying to create queues and topics in Active MQ using below, also it is able to create the queue in ActiveMQ, but when i am trying to run my message flow I am seeing couple of errors in eventviewer
( ACENODE03.IS01 ) ACE JMSClient. ''Broker 'ACENODE03'; Execution Group 'IS01'; Message Flow 'com.smm.CASEINIT'; Node 'JMS Input::ComIbmJMSClientInputNode' '' There is a configuration problem with the JNDI Administered objects where: Initial Context Factory = ''org.apache.activemq.jndi.ActiveMQInitialContextFactory''. Location of the bindings = ''tcp://lzbita187879as:61616''. ConnectionFactory Name = ''ConnectionFactory''. JMS destination = ''CASEINIT''. The exception text is : '' javax.naming.NameNotFoundException : CASEINIT, Unable to find JMS Destination in JNDI''.
The node cannot obtain a JNDI Administered Object, because some of the values specified are incorrect.
Check the JNDI Administered configuration for the JMS provider used by the node.
Either:
Modify the JNDI Administered objects and rebuild the bindings
or
Change the policy attributes associated with this JMS Provider and restart the integration server
or
Change the node attributes and redeploy the message flow.

Movesense CustomGATT and ECG or Accelerometer

There have been a few posts on this issue without any solutions announced.
Wanting to access internal movesense sensor data (ECG, Acc…) but without using the Android or iOS platforms ( as suggested by a movesense presentation https://www.movesense.com/wp-content/uploads/2018/11/2018-11-06-Using-Movesense-CustomGATTService.pdf ), I have failed to do so for at least 1 week.
I can successfully create my own GATT characteristics and subscribe to them from outside the movesense device. This is easily done by augmenting the samples/custom_gattsvc_app with a few lines :
Definition :
const uint16_t myCharUUID16 = 0x2A58; // this new characteristic will appear in the service as the third one in the sample
In CustomGATTSvcClient::configGattSvc() :
WB_RES::GattProperty myCharProp = WB_RES::GattProperty::INDICATE;
myChar.props = wb::MakeArray<WB_RES::GattProperty>( &myCharProp, 1);
myChar.uuid = wb::MakeArray<uint8_t>( reinterpret_cast<const uint8_t*>(&myCharUUID16), 2);
customGattSvc.chars = wb::MakeArray<WB_RES::GattChar>(characteristics, 3); // 3 here since there are 3 characteristics now
Accessing
You can now see and subscribe with a BTLE client (bluetility…) to the new service even if it does not do anything for now.
The problems start here for me :
In CustomGATTSvcClient::onGetResult() I try to force a subscription to ECG or Acc since onGetResult() is called by CustomGATTSvcClient::onPostResult() once all the BT services are created :
int32_t sampleRate = 10;
asyncSubscribe(WB_RES::LOCAL::MEAS_ACC_SAMPLERATE(),AsyncRequestOptions::Empty, sampleRate);
I do not implement onSubscribeResult()
In onNotify() you should be able to intercept the call from the whiteboard with the new data every 1/10 second by
switch (resourceId.getConstId()) {
case WB_RES::LOCAL::MEAS_ACC_SAMPLERATE::ID:
{
// To see a blinking LED on each new Acc data
asyncPut(WB_RES::LOCAL::COMPONENT_LED(),AsyncRequestOptions::Empty, myFlippingBool);
myFlippingBool = ! myFlippingBool;
}
What I have observed :
A. When I asyncSubscribe() the ECG or Acc, the sample’s WB_RES::LOCAL::MEAS_TEMP::LID is no longer called and no updates are dispatched to a BT client even after a successful subscription to the 0x2A1C characteristic. This means that all Notifications are disabled by a resource conflict ?
B. When subscribing ( as before ) or even by :
wb::Result result = getResource("Meas/Acc/10", mMyAccResourceId);
result = asyncSubscribe(mMyAccResourceId);
The onNotify() method is never called as the LED does not blink ( even directly after onNotify() implementation without the switch / case )
There is a lack of documentation on CustomGatt and it seems it blocks many people in integrating the sensor on other platforms ( Raspberry Pi or generic processors running a BT stack ).
I have tried before to access the movesense platform with direct AT commands from a rudimentary microcontroller and a BT module without success (Movesense direct access to GATT endpoints ), so now I’m turning to a Raspberry solution + Qt without success.
Thank you for any example or answers to this question !
At least 10 Hz is not supported. What happens with Meas\Acc\13 ?

How to start and stop multiple weblogic managed servers at one go through WLST

I am writing a code to start , stop, undeploy and deploy my application on weblogc.
My components need to be deployed on few managed servers.
When I do new deployments manually I can start and stop the servers in parallel, by ticking multiple boxes and selecting start and stop from the dop down. See below.
but when trying from WLST, i could do that in one server at a time.
ex:
start(name='ServerX',type='Server',block='true')
start(name='ServerY',type='Server',block='true')
shutdown(name='ServerX',entityType='Server',ignoreSessions='true',timeOut=600,force='true',block='true')
shutdown(name='ServerY',entityType='Server',ignoreSessions='true',timeOut=600,force='true',block='true')
Is there a way I can start stop multiple servers in once command?
Instead of directly starting and stopping servers, you create tasks, then wait for them to complete.
e.g.
tasks = []
for server in cmo.getServerLifeCycleRuntimes():
# to shut down all servers
if (server.getName() != ‘AdminServer’ and server.getState() != ‘RUNNING’ ):
tasks.append(server.start())
#or to start them up:
#if (server.getName() != ‘AdminServer’ and server.getState() != ‘SHUTDOWN’ ):
# tasks.append(server.shutdown())
#wait for tasks to complete
while len(tasks) > 0:
for task in tasks:
if task.getStatus() != ‘TASK IN PROGRESS’ :
tasks.remove(task)
java.lang.Thread.sleep(5000)
I know this is an old post, today I was reading this book "Advanced WebLogic Server Automation" written by Martin Heinzl so in the page 282 I found this.
def startCluster(clustername):
try:
start(clustername, 'Cluster')
except Exception, e:
print 'Error while starting cluster', e
dumpStack()
I tried it and it started managed servers in parallel.
Just keep in mind the AdminServer must be started first and your script must connect to the AdminServer before trying it.
Perhaps this would not be useful for you as the servers should be in a cluster, but I wanted to share this :)

MQL4 How To Detect Status During Change of Account (Completed Downloading of Historical Trades)

In MT4, there exists a stage/state: when we switch from AccountA to AccountB, when Connection is established and init() and start() are triggered by MT4; but before the "blinnnggg" (sound) when all the historical/outstanding trades are loaded from Server.
Switch Account>Establish Connection>Trigger Init()/Start() events>Start Downloading of Outstanding/Historical trades>Completed Downloading (issue "bliinng" sound).
I need to know (in MQL4) that all the trades are completed downloaded from the tradeServer --to know that the account is truly empty -vs- still downloading history from tradeServer.
Any pointer will be appreciated. I've explored IsTradeAllowed() IsContextBusy() and IsConnected(). All these are in "normal" state and the init() and start() events are all fired ok. But I cannot figure out if the history/outstanding trade lists has completed downloading.
UPDATE: The final workaround I finally implemented was to use the OrdersHistoryTotal(). Apparently this number will be ZERO (0) during downloading of order history. And it will NEVER be zero (due to initial deposit). So, I ended-up using this as a "flag".
Observation
As the problem was posted, there seems no such "integrated" method for MT4-Terminal.
IsTradeAllowed() reflects an administrative state of the account/access to the execution of the Trading Services { IsTradeAllowed | !IsTradeAllowed }
IsConnected() reflects a technical state of the visibility / login credentials / connection used upon an attempt to setup/maintain an online connection between a localhost <-> Server { IsConnected() | !IsConnected() }
init() {...} is a one-stop setup facility, that is/was being called once an MT4-programme { ExpertAdvisor | Script | TechnicalIndicator } was launched on a localhost machine. This facility is strongly advised to be non-blocking and non-re-entrant. A change from the user account_A to another user account_B is typically ( via an MT4-configuration options ) a reason to stop an execution of a previously loaded MQL4-code ( be it an EA / a Script / a Technical Indicator ) )
start() {...} is an event-handler facility, that endlessly waits, for a next occurrence of an FX-Market Event appearance ( being propagated down the line by the Broker MT4-Server automation ) that is being announced via an established connection downwards, to the MT4-Terminal process, being run on a localhost machine.
A Workaround Solution
As understood, the problem may be detected and handled indirectly.
While the MT4 platform seems to have no direct method to distinguish between the complete / in-complete refresh of the list of { current | historical } trades, let me propose a method of an indirect detection thereof.
Try to launch a "signal"-trade ( a pending order, placed geometrically well far away, in the PriceDOMAIN, from the current Ask/Bid-levels ).
Once this trade would be end-to-end registered ( Server-side acknowledged ), the local-side would have confirmed the valid state of the db.POOL
Making this a request/response pattern between localhost/MT4-Server processes, the localhost int init(){...} / int start(){...} functionality may thus reflect a moment, when the both sides have synchronised state of the records in db.POOL

Problems deploying Grails application on cloudbees

I'm new cloudbees user, I've succeeded in building my war file but I can't deploy it because when a I'm going to use Deploy Now option, putting my application ID claxon/claxon I always get the same error:
**"hudson.util.IOException2: Server.InternalError - Expected Application ID format: account/appname > claxon/"**
this is the log..
hudson.util.IOException2: Server.InternalError - Expected Application ID format: account/appname > claxon/
at com.cloudbees.plugins.deployer.deployables.Deployable.deployFile(Deployable.java:152)
at com.cloudbees.plugins.deployer.DeployNowRunAction$Deployer.perform(DeployNowRunAction.java:639)
at com.cloudbees.plugins.deployer.DeployNowRunAction.run(DeployNowRunAction.java:484)
at com.cloudbees.plugins.deployer.DeployNowTask$ExecutableImpl.run(DeployNowTask.java:157)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:236)
Caused by: com.cloudbees.api.BeesClientException: Server.InternalError - Expected Application ID format: account/appname > claxon/
at com.cloudbees.api.BeesClient.readResponse(BeesClient.java:850)
at com.cloudbees.api.BeesClient.applicationDeployArchive(BeesClient.java:435)
at com.cloudbees.plugins.deployer.deployables.Deployable.deployFile(Deployable.java:124)
... 5 more
Duration: 4.1 sec
Finished: FAILURE
Anybody can help me?.
Don't put the claxon/ the account is sorted for you when you choose the account from the account drop down. just put the id part.
If you expand the help text you will see that it says not to prefix:
Note: I used my superuser rights to capture this screenshot... the only bit that might be confidential is your account name, which you had already exposed via the original question.