Java Runnable Services

What product/components do you use and which version/fix level are you on?

IS 10.7

What are you trying to achieve? Please describe it in detail.

Hello, I want to ask about a java service issue that happened on my IS, so i’m having a java services that include a runnable, it will execute (per interval duration) and invoke a method in a shared source, but it seems it doesn’t call the methods that invoked on the runnable and it stopped every time it run 1x,it supposed to be called every 10 seconds, below are the example codes

Runnable runnable = new Runnable() { public void run() {
			System.out.println("Invoke Methods");
			processDisabledConn();
			System.out.println("Every 5 sec: "+ new java.util.Date());
		  }
		};
		
		ScheduledExecutorService service = Executors.newSingleThreadScheduledExecutor(); 
		ScheduledFuture<?> beeperHandle=service.scheduleAtFixedRate(runnable, 0, 10, TimeUnit.SECONDS);
	
		service.schedule(new Runnable(){
			public void run() { 
				beeperHandle.cancel(true); 
				System.out.println("Exit Scheduler");
			}
		}, 30, TimeUnit.SECONDS);

Does anyone have idea about this? Why this happened, and any alternative to this issue? Thank you

1 Like

Hi, Why are using java service to schedule a service? Can’t you use IS scheduler task?

1 Like

Hi @Mohankumar_N,
it’s because i need to invoke the methods on the java shared source, and i think it will be better if i used java instead of the IS Scheduler by creating 1 flow service each scheduler, or is there any way how to invoke the java shared source asynchronously? like doThreadInvoke but for java methods?

1 Like

To perhaps explore additional options, what prompted the need/approach to create (static) methods in shared source? Obviously you want/need to invoke something periodically, but why is that “something” methods in shared code? Why are they not individual Java services?

Given the info thus far, I’m with @Mohankumar_N that the “wM IS way” in this case is creating services that are scheduled via IS Administrator. These services might use methods in the shared code area but that may not be necessary/useful.

Can you share a bit more about what led to this design approach?

1 Like

It’s because i’m trying to manage a static volatile arrays that required a multithreading, and i thought that with java services approach it require less flow services needed and much more managable

Also @reamon actually i found out why the runnable doesn’t invoke the method i called, it’s actually failed to invoke the method when i turned the server.log to debug mode, and i found this

2022-11-29 09:31:05 ICT [ISS.0007.0003D] (tid=30) ACLManager: allow check for user "local/Default" on ACL "Internal" is returning false. 
2022-11-29 09:31:05 ICT [ISS.0007.0006D] (tid=30) ACLManager: allow check for user "local/Default" on service "pub.art.connection:enableConnection" is returning false. 

i think i need to manage the access control list on each runnable on the java services, thanks

Hi @mcser76 ,

Yeah, ACL related changes can be modified for services in Designer by right-clicking on the service > properties :point_down:

Thanks,
Dharini

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.