How to properly implement custom ServiceFailurePolicy

I'd like to use Coherence service guardian to interrupt & cancel hung cacheloader threads, which are going into infinite loop due to database connection became unresponsive.
For that purpose I've tried first to create working testcase in order to learn how service guardian works.
I've created a basic distributed cache with fake cache loader to imitate a delay in response, then an infinite loop, and custom test service guardian policy.
I do see cache loader being interrupted by a call to onGuardableRecovery, but then strange thing happens: despite cacheloader thread being successfully released, service guardian still thinks that the service is stuck and tries several times to recover by calling onGuardableRecovery and finally to terminate service with the call to onGuardableTerminate.
What I'm missing here or doing wrong ?
Below are testcase classes & cache config:
package test.guardian;
import com.tangosol.net.CacheFactory;
import com.tangosol.net.cache.CacheStore;
import com.tangosol.util.Base;
import java.util.Collection;
import java.util.Map;
public class testCacheStore extends Base implements CacheStore {
private String datasource_name = null;
public static volatile boolean loop_thread = true;
public testCacheStore(String p_datasource_name) {
CacheFactory.log("inside cacheloader constructor, p_datasource_name="+p_datasource_name,CacheFactory.LOG_DEBUG);
this.datasource_name = p_datasource_name;
public Object load(Object oKey) {
CacheFactory.log("inside cacheloader",CacheFactory.LOG_DEBUG);
try {
Thread.sleep(120*1000);
catch (InterruptedException e) {
CacheFactory.log("loader thread was interrupted"+"\n"+CacheFactory.getStackTrace(e),CacheFactory.LOG_DEBUG);
while (testCacheStore.loop_thread) {String n = "1"+"2";}
CacheFactory.log("loader stop_thread flag was set to stop thread",CacheFactory.LOG_DEBUG);
CacheFactory.log("return value from the store",CacheFactory.LOG_DEBUG);
return ((String) oKey)+"-value";
public Map loadAll(Collection colKeys) {
throw new UnsupportedOperationException();
public void store(Object oKey, Object oValue) {
public void storeAll(Map mapEntries) {
throw new UnsupportedOperationException();
public void erase(Object oKey) {
public void eraseAll(Collection colKeys) {
CacheFactory.log("inside eraseAll method", CacheFactory.LOG_DEBUG);
throw new UnsupportedOperationException();
package test.guardian;
import com.tangosol.net.CacheFactory;
import com.tangosol.net.Guardable;
import com.tangosol.net.ServiceFailurePolicy;
import com.tangosol.net.Service;
import com.tangosol.net.Cluster;
public class mycustomGPolicy implements ServiceFailurePolicy {   
public static mycustomGPolicy getInstance() {
return new mycustomGPolicy();
public mycustomGPolicy(String p_info) {
CacheFactory.log("parametrized policy class instance created",CacheFactory.LOG_DEBUG);
CacheFactory.log("p_info="+p_info,CacheFactory.LOG_DEBUG);
public mycustomGPolicy() {
CacheFactory.log("policy class instance created",CacheFactory.LOG_DEBUG);
//CacheFactory.log("p_info="+p_info,CacheFactory.LOG_DEBUG);
public void onGuardableRecovery(Guardable p_guardable, Service p_service) {
CacheFactory.log("inside onGuardableRecovery",CacheFactory.LOG_DEBUG);
CacheFactory.log("p_guardable="+p_guardable.toString(),CacheFactory.LOG_DEBUG);
CacheFactory.log("p_guardable.getClass().getCanonicalName()="+p_guardable.getClass().getCanonicalName(),CacheFactory.LOG_DEBUG);
testCacheStore.loop_thread = false;
p_guardable.recover();
p_guardable.getContext().heartbeat();
public void onGuardableTerminate(Guardable p_guardable, Service p_service) {
CacheFactory.log("inside onGuardableTerminate",CacheFactory.LOG_DEBUG);
CacheFactory.log("p_guardable="+p_guardable.toString(),CacheFactory.LOG_DEBUG);
CacheFactory.log("p_guardable.getClass().getCanonicalName()="+p_guardable.getClass().getCanonicalName(),CacheFactory.LOG_DEBUG);
testCacheStore.loop_thread = false;
p_guardable.terminate();
public void onServiceFailed(Cluster p_cluster) {
CacheFactory.log("inside onServiceFailed",CacheFactory.LOG_DEBUG);
package test.guardian;
import com.tangosol.net.CacheFactory;
import com.tangosol.net.NamedCache;
public class testGuardianCache {
public static void main(String[] args) {
try {
log("building cache instance");
NamedCache cache = CacheFactory.getCache("test-guardable");
log("requesting cache data");
String resp4 = (String)cache.get("test1223g");
log("response:");
System.out.println(resp4+"\n");
} catch (com.tangosol.io.pof.PortableException e) {
Throwable e_src = e;
while (e_src.getCause() != null ) {
e_src = e_src.getCause();
e_src.printStackTrace();
public static void log(String info) {
System.out.println(info);
<?xml version="1.0" encoding="UTF-8"?>
<cache-config>
     <caching-scheme-mapping>
          <cache-mapping>
               <cache-name>test-guardable</cache-name>
               <scheme-name>test-guardable-schema</scheme-name>
          </cache-mapping>
     </caching-scheme-mapping>
     <caching-schemes>
          <distributed-scheme>
               <scheme-name>test-guardable-schema</scheme-name>
               <service-name>test-guardable-service</service-name>
               <backing-map-scheme>
                    <read-write-backing-map-scheme>
                         <cachestore-timeout>0</cachestore-timeout>
                         <internal-cache-scheme>
                              <external-scheme>
                              <scheme-name>LocalNioLtd</scheme-name>
                              <high-units>10000</high-units>
                              <unit-calculator>FIXED</unit-calculator>
                              <nio-memory-manager>
                              <initial-size>10M</initial-size>
                              <maximum-size>50M</maximum-size>
                              </nio-memory-manager>
                              </external-scheme>
                         </internal-cache-scheme>
                         <cachestore-scheme>
                              <class-scheme>
                                   <class-name>test.guardian.testCacheStore</class-name>
                                   <init-params>
                                   <init-param>
                                   <param-type>java.lang.String</param-type>
                                   <param-value>jdbc-coherence/MY-CACHE-DS</param-value>
                                   </init-param>
                                   </init-params>
                              </class-scheme>
                         </cachestore-scheme>
                         <rollback-cachestore-failures>true</rollback-cachestore-failures>
                         <read-only>true</read-only>
                         <write-delay-seconds>0</write-delay-seconds>
                    </read-write-backing-map-scheme>
               </backing-map-scheme>
               <listener/>
               <autostart>true</autostart>
               <thread-count>10</thread-count>
               <guardian-timeout>10000</guardian-timeout>
               <service-failure-policy>
          <class-name>test.guardian.mycustomGPolicy</class-name>
                                   <init-params>
                                   <init-param>
                                   <param-name>datasource</param-name>
                                   <param-type>java.lang.String</param-type>
                                   <param-value>jdbc-coherence/MY-CACHE-DS</param-value>
                                   </init-param>
                                   </init-params>
          </service-failure-policy>
          </distributed-scheme>
     </caching-schemes>
</cache-config>
<?xml version="1.0"?>
<coherence>
     <services>
          <service>
               <service-type>DistributedCache</service-type>
               <service-component>DistributedCache</service-component>
               <init-params>
                    <init-param id="4">
                         <param-name>local-storage</param-name>
                         <param-value system-property="tangosol.coherence.distributed.localstorage">false</param-value>
                    </init-param>
               </init-params>
          </service>
     </services>
     <cluster-config>
<member-identity>
<cluster-name>WORKSTATION</cluster-name>
</member-identity>
          <unicast-listener>
               <address system-property="tangosol.coherence.localhost">localhost</address>
               <port system-property="tangosol.coherence.localport">7070</port>
               <port-auto-adjust system-property="tangosol.coherence.localport.adjust">true</port-auto-adjust>
               <well-known-addresses>
<socket-address id="1"><address>localhost</address><port>7070</port></socket-address>
</well-known-addresses>
          </unicast-listener>
          <authorized-hosts/>
          <logging-config>
               <severity-level system-property="tangosol.coherence.log.level">5</severity-level>
               <character-limit system-property="tangosol.coherence.log.limit">0</character-limit>
          </logging-config>
     </cluster-config>
     <logging-config>
          <severity-level>5</severity-level>
          <message-format>{date} &lt;{level}&gt; (thread={thread}, member={member}): {text}</message-format>
          <character-limit>8192</character-limit>
     </logging-config>
</coherence>
setlocal
set COHERENCE_HOME=c:\coherence36
set PROG_HOME=C:\coherence36\deploy
set COH_OPTS=-cp %COHERENCE_HOME%\lib\coherence.jar;%PROG_HOME%\testguardable.jar
set JMX_OPTS=-Dcom.sun.management.jmxremote -Dtangosol.coherence.management=all -Dtangosol.coherence.management.remote=true -Dcom.sun.management.jmxremote.authenticate=true -Dcom.sun.management.jmxremote.ssl=false
set OVERRIDE_OPTS=-Dtangosol.coherence.override=%PROG_HOME%\tangosol-coherence-override.xml
rem
rem
start "1testguardable" /MAX C:\jdev10g\jdk\jre\bin\java.exe %COH_OPTS% %OVERRIDE_OPTS% -Xms256m -Xmx256m -Xloggc: -Dtangosol.coherence.distributed.localstorage=true -Dtangosol.coherence.cacheconfig=%PROG_HOME%\testguardable-cache-config.xml com.tangosol.net.DefaultCacheServer

INFO - 2010-07-23 23:43:07.906 <Info> (thread=main, member=n/a): Loaded operational configuration from "jar:file:/C:/coherence36/lib/coherence.jar!/tangosol-coherence.xml"
INFO - 2010-07-23 23:43:07.921 <Info> (thread=main, member=n/a): Loaded operational overrides from "file:/C:/-PRG/coherence_ws/Guardian/deploy/tangosol-coherence-override.xml"
DEBUG - 2010-07-23 23:43:07.937 <D5> (thread=main, member=n/a): Optional configuration override "/custom-mbeans.xml" is not specified
DEBUG -
Oracle Coherence Version 3.6.0.0 Build 17229
Grid Edition: Development mode
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
INFO - 2010-07-23 23:43:08.531 <Info> (thread=main, member=n/a): Loaded cache configuration from "file:/C:/-PRG/coherence_ws/Guardian/deploy/testguardable-cache-config.xml"
DEBUG - 2010-07-23 23:43:09.515 <D4> (thread=main, member=n/a): TCMP bound to /192.168.1.10:7070 using SystemSocketProvider
INFO - 2010-07-23 23:43:41.000 <Info> (thread=Cluster, member=n/a): Created a new cluster "WORKSTATION" with Member(Id=1, Timestamp=2010-07-23 23:43:09.531, Address=192.168.1.10:7070, MachineId=26890, Location=site:local,machine:WS,process:5880, Role=CoherenceServer, Edition=Grid Edition, Mode=Development, CpuCount=2, SocketCount=1) UID=0xC0A8010A0000012A01427FDB690A1B9E
INFO - 2010-07-23 23:43:41.015 <Info> (thread=main, member=n/a): Started cluster Name=WORKSTATION
WellKnownAddressList(Size=1,
WKA{Address=192.168.1.10, Port=7070}
MasterMemberSet
ThisMember=Member(Id=1, Timestamp=2010-07-23 23:43:09.531, Address=192.168.1.10:7070, MachineId=26890, Location=site:local,machine:WS,process:5880, Role=CoherenceServer)
OldestMember=Member(Id=1, Timestamp=2010-07-23 23:43:09.531, Address=192.168.1.10:7070, MachineId=26890, Location=site:local,machine:WS,process:5880, Role=CoherenceServer)
ActualMemberSet=MemberSet(Size=1, BitSetCount=2
Member(Id=1, Timestamp=2010-07-23 23:43:09.531, Address=192.168.1.10:7070, MachineId=26890, Location=site:local,machine:WS,process:5880, Role=CoherenceServer)
RecycleMillis=1200000
RecycleSet=MemberSet(Size=0, BitSetCount=0
TcpRing{Connections=[]}
IpMonitor{AddressListSize=0}
DEBUG - 2010-07-23 23:43:41.093 <D5> (thread=Invocation:Management, member=1): Service Management joined the cluster with senior service member 1
DEBUG - 2010-07-23 23:43:41.718 <D5> (thread=main, member=1): parametrized policy class instance created
DEBUG - 2010-07-23 23:43:41.718 <D5> (thread=main, member=1): p_info=jdbc-coherence/MY-CACHE-DS
DEBUG - 2010-07-23 23:43:41.750 <D5> (thread=DistributedCache:test-guardable-service, member=1): Service test-guardable-service joined the cluster with senior service member 1
INFO - 2010-07-23 23:43:41.890 <Info> (thread=main, member=1):
Services
ClusterService{Name=Cluster, State=(SERVICE_STARTED, STATE_JOINED), Id=0, Version=3.6, OldestMemberId=1}
InvocationService{Name=Management, State=(SERVICE_STARTED), Id=1, Version=3.1, OldestMemberId=1}
PartitionedCache{Name=test-guardable-service, State=(SERVICE_STARTED), LocalStorage=enabled, PartitionCount=257, BackupCount=1, AssignedPartitions=257, BackupPartitions=0}
Started DefaultCacheServer...
DEBUG - 2010-07-23 23:44:50.250 <D5> (thread=Cluster, member=1): Member(Id=2, Timestamp=2010-07-23 23:44:50.258, Address=192.168.1.10:7072, MachineId=26890, Location=site:local,machine:WS,process:3376, Role=TestGuardianTestGuardianCache) joined Cluster with senior member 1
DEBUG - 2010-07-23 23:44:50.390 <D5> (thread=Cluster, member=1): Member 2 joined Service Management with senior member 1
DEBUG - 2010-07-23 23:44:51.093 <D5> (thread=Cluster, member=1): Member 2 joined Service test-guardable-service with senior member 1
DEBUG - 2010-07-23 23:44:51.218 <D5> (thread=DistributedCache:test-guardable-service, member=1): inside cacheloader constructor, p_datasource_name=jdbc-coherence/MY-CACHE-DS
DEBUG - 2010-07-23 23:44:51.359 <D5> (thread=test-guardable-serviceWorker:4, member=1): inside cacheloader
DEBUG - 2010-07-23 23:45:00.375 <D5> (thread=Recovery Thread, member=1): inside onGuardableRecovery
DEBUG - 2010-07-23 23:45:00.375 <D5> (thread=Recovery Thread, member=1): p_guardable=Guard{Daemon=test-guardable-serviceWorker:4}
DEBUG - 2010-07-23 23:45:00.375 <D5> (thread=Recovery Thread, member=1): p_guardable.getClass().getCanonicalName()=com.tangosol.coherence.component.util.daemon.queueProcessor.Service$DaemonPool$Daemon$Guard
ERROR - 2010-07-23 23:45:00.375 <Error> (thread=DistributedCache:test-guardable-service, member=1): Attempting recovery (due to soft timeout) of {WrapperGuardable Guard{Daemon=test-guardable-serviceWorker:4} Service=PartitionedCache{Name=test-guardable-service, State=(SERVICE_STARTED), LocalStorage=enabled, PartitionCount=257, BackupCount=1, AssignedPartitions=257, BackupPartitions=0}}
WARN - 2010-07-23 23:45:00.375 <Warning> (thread=Recovery Thread, member=1): A worker thread has been executing task: Message "GetRequest"
FromMember=Member(Id=2, Timestamp=2010-07-23 23:44:50.258, Address=192.168.1.10:7072, MachineId=26890, Location=site:local,machine:WS,process:3376, Role=TestGuardianTestGuardianCache)
FromMessageId=29
Internal=false
MessagePartCount=1
PendingCount=0
MessageType=59
ToPollId=0
Poll=null
Packets
[000]=Directed{PacketType=0x0DDF00D5, ToId=1, FromId=2, Direction=Incoming, ReceivedMillis=23:44:51.343, ToMemberSet=null, ServiceId=2, MessageType=59, FromMessageId=29, ToMessageId=27, MessagePartCount=1, MessagePartIndex=0, NackInProgress=false, ResendScheduled=none, Timeout=none, PendingResendSkips=0, DeliveryState=unsent, Body=0}
Service=PartitionedCache{Name=test-guardable-service, State=(SERVICE_STARTED), LocalStorage=enabled, PartitionCount=257, BackupCount=1, AssignedPartitions=257, BackupPartitions=0}
ToMemberSet=MemberSet(Size=1, BitSetCount=2
Member(Id=1, Timestamp=2010-07-23 23:43:09.531, Address=192.168.1.10:7070, MachineId=26890, Location=site:local,machine:WS,process:5880, Role=CoherenceServer)
NotifySent=false
} for 9016ms and appears to be stuck; attempting to interrupt: test-guardable-serviceWorker:4
DEBUG - 2010-07-23 23:45:00.375 <D5> (thread=test-guardable-serviceWorker:4, member=1): loader thread was interrupted
     at java.lang.Thread.sleep(Native Method)
     at test.guardian.testCacheStore.load(testCacheStore.java:26)
     at com.tangosol.net.cache.ReadWriteBackingMap$CacheStoreWrapper.load(ReadWriteBackingMap.java:4759)
     at com.tangosol.net.cache.ReadWriteBackingMap$CacheStoreWrapper.loadInternal(ReadWriteBackingMap.java:4344)
     at com.tangosol.net.cache.ReadWriteBackingMap.get(ReadWriteBackingMap.java:807)
     at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache.onGetRequest(PartitionedCache.CDB:22)
     at com.tangosol.coherence.component.util.daemon.queueProcessor.service.grid.partitionedService.PartitionedCache$GetRequest.run(PartitionedCache.CDB:1)
     at com.tangosol.coherence.component.util.DaemonPool$WrapperTask.run(DaemonPool.CDB:1)
     at com.tangosol.coherence.component.util.DaemonPool$WrapperTask.run(DaemonPool.CDB:32)
     at com.tangosol.coherence.component.util.DaemonPool$Daemon.onNotify(DaemonPool.CDB:63)
     at com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:42)
     at java.lang.Thread.run(Thread.java:595)
DEBUG - 2010-07-23 23:45:00.375 <D5> (thread=test-guardable-serviceWorker:4, member=1): loader stop_thread flag was set to stop thread
DEBUG - 2010-07-23 23:45:00.375 <D5> (thread=test-guardable-serviceWorker:4, member=1): return value from the store
DEBUG - 2010-07-23 23:45:00.390 <D5> (thread=Cluster, member=1): TcpRing disconnected from Member(Id=2, Timestamp=2010-07-23 23:44:50.258, Address=192.168.1.10:7072, MachineId=26890, Location=site:local,machine:WS,process:3376, Role=TestGuardianTestGuardianCache) due to a peer departure; removing the member.
DEBUG - 2010-07-23 23:45:00.390 <D5> (thread=Cluster, member=1): Member 2 left service Management with senior member 1
DEBUG - 2010-07-23 23:45:00.390 <D5> (thread=Cluster, member=1): Member 2 left service test-guardable-service with senior member 1
DEBUG - 2010-07-23 23:45:00.390 <D5> (thread=Cluster, member=1): Member(Id=2, Timestamp=2010-07-23 23:45:00.39, Address=192.168.1.10:7072, MachineId=26890, Location=site:local,machine:WS,process:3376, Role=TestGuardianTestGuardianCache) left Cluster with senior member 1
ERROR - 2010-07-23 23:48:16.250 <Error> (thread=Cluster, member=1): Attempting recovery (due to soft timeout) of {WrapperGuardable Guard{Daemon=DistributedCache:test-guardable-service} Service=PartitionedCache{Name=test-guardable-service, State=(SERVICE_STARTED), LocalStorage=enabled, PartitionCount=257, BackupCount=1, AssignedPartitions=257, BackupPartitions=0}}
DEBUG - 2010-07-23 23:48:16.250 <D5> (thread=Recovery Thread, member=1): inside onGuardableRecovery
DEBUG - 2010-07-23 23:48:16.250 <D5> (thread=Recovery Thread, member=1): p_guardable=Guard{Daemon=DistributedCache:test-guardable-service}
DEBUG - 2010-07-23 23:48:16.250 <D5> (thread=Recovery Thread, member=1): p_guardable.getClass().getCanonicalName()=com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid$Guard
DEBUG - Interrupted PartitionedCache, Thread[DistributedCache:test-guardable-service,5,Cluster]
ERROR - 2010-07-23 23:48:46.765 <Error> (thread=Cluster, member=1): Terminating guarded execution (due to hard timeout) of {WrapperGuardable Guard{Daemon=DistributedCache:test-guardable-service} Service=PartitionedCache{Name=test-guardable-service, State=(SERVICE_STARTED), LocalStorage=enabled, PartitionCount=257, BackupCount=1, AssignedPartitions=257, BackupPartitions=0}}
DEBUG - 2010-07-23 23:48:46.765 <D5> (thread=Termination Thread, member=1): inside onGuardableTerminate
DEBUG - 2010-07-23 23:48:46.765 <D5> (thread=Termination Thread, member=1): p_guardable=Guard{Daemon=DistributedCache:test-guardable-service}
DEBUG - 2010-07-23 23:48:46.765 <D5> (thread=Termination Thread, member=1): p_guardable.getClass().getCanonicalName()=com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid$Guard
DEBUG - 2010-07-23 23:48:46.765 <D5> (thread=DistributedCache:test-guardable-service, member=1): Service test-guardable-service left the cluster
INFO - 2010-07-23 23:48:46.890 <Info> (thread=main, member=1): Restarting Service: test-guardable-service
DEBUG - 2010-07-23 23:48:46.906 <D5> (thread=main, member=1): parametrized policy class instance created
DEBUG - 2010-07-23 23:48:46.906 <D5> (thread=main, member=1): p_info=jdbc-coherence/MY-CACHE-DS
DEBUG - 2010-07-23 23:48:46.906 <D5> (thread=DistributedCache:test-guardable-service, member=1): Service test-guardable-service joined the cluster with senior service member 1
ERROR - 2010-07-23 23:48:55.265 <Error> (thread=Cluster, member=1): Attempting recovery (due to soft timeout) of {WrapperGuardable Guard{Daemon=DistributedCache:test-guardable-service} Service=PartitionedCache{Name=test-guardable-service, State=(SERVICE_STOPPED), Not initialized}}
DEBUG - 2010-07-23 23:48:55.265 <D5> (thread=Recovery Thread, member=1): inside onGuardableRecovery
DEBUG - 2010-07-23 23:48:55.265 <D5> (thread=Recovery Thread, member=1): p_guardable=Guard{Daemon=DistributedCache:test-guardable-service}
DEBUG - 2010-07-23 23:48:55.265 <D5> (thread=Recovery Thread, member=1): p_guardable.getClass().getCanonicalName()=com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid$Guard
ERROR - 2010-07-23 23:48:56.281 <Error> (thread=Cluster, member=1): Terminating guarded execution (due to hard timeout) of {WrapperGuardable Guard{Daemon=DistributedCache:test-guardable-service} Service=PartitionedCache{Name=test-guardable-service, State=(SERVICE_STOPPED), Not initialized}}
DEBUG - 2010-07-23 23:48:56.281 <D5> (thread=Termination Thread, member=1): inside onGuardableTerminate
DEBUG - 2010-07-23 23:48:56.281 <D5> (thread=Termination Thread, member=1): p_guardable=Guard{Daemon=DistributedCache:test-guardable-service}
DEBUG - 2010-07-23 23:48:56.281 <D5> (thread=Termination Thread, member=1): p_guardable.getClass().getCanonicalName()=com.tangosol.coherence.component.util.daemon.queueProcessor.service.Grid$Guard

Similar Messages

  • How do I implement custom controlers

    I have develloped a custom controler which runs fine in the developer zone on my Win 2000 notebook. When building an application the same controller looks strange and does not keep its proportions on a Win NT workstation. I implemented the controler both as dynamic vi and as support file when building the exe - still it won't work correctly. When repairing the controler and building the application on the NT workstation the same controler does not work on my notebook. Whats wrong?

    Hello;
    You need to be more specific on what you have changed and maybe attach the VI so we can help you better.
    Regards
    Filipe A.
    Applications Engineer
    National Instruments

  • How to properly reference libraries when building executable

    Hi guys,
    So I've been working on porting a VI developed on 2009 Labview on Windows over to 8.2 on Linux. Initially I was having some problems because the program seem to have broken after the port but we realized it was some compatiblity with the TCP communcation functions. We solved it by writing some new TCP open/send/recieve/close functions in C and called the functions through a sub VI calling a library function node.
    Now, the program runs completely fine on labview on the development machine where I have all the files. However, things seem to break down when I build the program as an executable to be run on a machine without labview. 
    From what I can tell, it seems as though the library function node is unable to find the proper .so file to reference. However, I've tried numerous methods of passing the correct path of the .so file to the library function no but nothing seems to work. I've tried implementing path on the sub-vi level then up to the vi level but the results are all the same, the program works in labview fine but the TCP communcations break when i compile.
    So can anyone tell me or point me to a good tutorial on how to properly implement and build with library function nodes and also properly referecing the required .so files?
    Thanks guys,
    Jason.

    Hi Jason,
    If you open example finder in LabVIEW (Help>>Find Examples…)  and search DLL, you may find the “External Code (DLL) Execution.vi” to be helpful.
    There is some thorough documentation on how to use external code in LabVIEW at the following link:
    http://www.ni.com/pdf/manuals/370109a.pdf
    I would double check to make sure you are compiling the C code to the correct format.  To run it on a Linux machine the .so file must be in the ELF file format, not the PE format (which is what DLL files use).
    I am also wondering why you need to re-write the TCP functions, there should be a Linux LabVIEW equivalent function for each of the LabVIEW Windows functions.
    Regards,
    Shane C
    Regards,
    Shane C
    Applications Engineer
    National Instruments

  • How to Implement custom share functionality in SharePoint 2013 document Lib programmatically?

    Hi,
    I have created custom action for Share functionality in document library.
    On Share action i'm showing Model pop up with Share form with addition functionality.
    I am developing custom share functionality because there is some addition functionality related to this.
    How to Implement custom share functionality in SharePoint 2013  document Lib pro-grammatically?
    Regards,
    - Siddhehswar

    Hi Siddhehswar:
    I would suggest that you use the
    Ribbon. Because this is a flexible way for SharePoint. In my project experience, I always suggest my customers to use it. In the feature, if my customers have customization about permission then i can accomplish this as soon
    as possible. Simple put, I utilize this perfect mechanism to resolve our complex project requirement. Maybe we customize Upload/ Edit/ Modify/ Barcode/ Send mail etc... For example:
    We customize <Edit> Ribbon. As shown below.
    When user click <Edit Item>, the system will
    render customized pop up window.
    Will

  • How to implement custom Model Class in Oracle ADF?

    I am using Oracle ADF for one of my project and i am using Query component of ADF. For given tables the query component creates view objects and maps the relations. ADF uses its own custom model class for this component and it should understand the DB tables. But for my project i have no access to database. All i can do is pass a string or object/query to the existing (custom) Java class/object, and this model class formulates query and queries the database and returns the value to my Java class. I have to display these results using ADF to the front end. Is There a way to achieve this? Can i replace/override the existing Model class of ADF. If so how?
    Thanks in advance for your help.

    Hi, there:
    Best thing to do is to start with the default login.html page, and then modify it. The login screen is fairly complex and it's easy to just miss a JS function you need to call. To get to default page, you would need to do one deploy (to simulator or whatever), and then look for login.html page in the temporary Xcode or Android project generated from the deployment. It should be under the "deploy" directory in your JDev workspace.
    You can also see all the framework JS files and CSS files that way as well.
    We have had customers implementing custom login screen so we know it can work, but they all had to start with the default login screen and then modify it.
    Thanks,
    Joe Huang

  • How to implement custom field renderer?

    I'm trying to create a custom field renderer that will render certain database fields as checkboxes in HTML. I'm using the Data Web Beans/JSP approach. In my view object I have added a "Boolean" property to the attributes that represent boolean type fields (e.g., field Warranty to indicate if an asset is under warranty). I have created a CheckBoxField() class similar to the TextField() class, and call it if the attribute is a boolean, but I can't figure out how to set the custom field renderer. When the program runs, it still uses the TextField renderer. The JDeveloper online documentation doesn't say anything about it. Is there a sample program or some other documentation that implements a custom field renderer?

    Hi,
    this document in addition
    http://www.oracle.com/technology/products/jdev/howtos/10g/jaassec/index.htm
    has a list of LoginModules, one that authenticates against physical database users
    Frank

  • How to implement Custom Authentication and Authorization in Oracle SOA 11g

    Can anyone please tell me, how to implement Custom Authentication in Oracle SOA 11g ?
    Because in Oracle SOA 10.1.3.4 , i have implemented this custom authentication and authorization by implementing BPMAuthenticationService, BPMAuthorizationService, BPMIdentityService to verify againt my database systems.
    implementation classes like the mentioned below
    1).
    public class SampleAuthenticationService extends SampleServiceBase implements BPMAuthenticationService {
    2).
    public class SampleAuthorizationService extends SampleServiceBase implements BPMAuthorizationService {
    3).
    public class SampleIdentityService extends SampleServiceBase implements BPMIdentityService {
    Please help me to implement the authentication and authorization in Oracle SOA 11g .
    thanks in advance

    To start with please go through following document
    http://docs.oracle.com/cd/E21764_01/integration.1111/e10231/adptr_jms.htm
    http://docs.oracle.com/cd/E23943_01/integration.1111/e10231/adptr_file.htm
    Regards
    Arpit

  • How to implement custom logging using log4j in Webcenter Portal Application

    I need to implement custom logging and export it to a new log file in Oracle 11.1.1.5 (Webcenter portal application). Please tell me the steps to implement this functionality.

    Please post questions for WebCenter Portal in it's own forum:
    WebCenter Portal

  • How to implement custom skin in JavaFX 2.0?

    To implement custom skin, I extend TextFieldSkin (in com.sun.javafx.scene.control.skin.*) class, but I don't know which methods to overwrite, anyone can provide some sample codes? Thanks!

    Hi,
    You can implement Skin interface or extend SkinBase class. I made some controls on my blog http://jojorabbitjavafxblog.wordpress.com/ but i still have not updated code to build 40. In my opinion the easiest way is to make first skin for Button class for example add text and Rectangle.

  • How to make a custom form, buttons etc... please...

    I mean, how to make a form (for example, JFrame) with arbitrary form (geometry, for ex, round, oval, star like etc). I think you understand what i mean.
    Of course, i think i can use winApi, but it's only for windows. It doesn't suit for Java in this problem solution.
    That question also about cusomizing form of buttons, fields.. etc..
    i think, everything.
    What can java allows to cusomize and what not.
    Thanx!!

    I am just a learner and so i can just suggest you a strategy to implement Customized forms in JAVA. However i am sure that in practice it will work as far as Windows OS are concerned. Here is it:-
    The basic IDEA is to declare a native function in JAVA that makes JNI calls which will be further processed by Win32API and processed output will result into an elliptic or any polygonal shaped forms.
    To achieve declare some function as follows:
    public native void createEllipticalForm(formName formRefrance);
    create a Win32 Compiled DLL that manages this function as follows:
    (Mindwell, i havent stated what you call as pure-code but just a pseudo-code to the actual implementation)
    public native void createEllipticalForm(formName formRefrance)
    /* Search for the below stated Functions in Win32 API and work on
    them. I see a ray of success if you work with these functions properly.
    Further-more I assume that you are aware with concept of HANDLES */
    createEllipticRegion(); //WINDOWS.H
    showWindow(handleToTheForm); //WINDOWS.H
    Search for "createEllipticRegion() or showWindow()" on the GOOGLE to get the pure win32 API Code for Creating Customized Forms.
    Reply me in case any of you people get a solution based on my idea.
    [by VISH]

  • How to create a custom listview with a specific listview item style?

    Hi everybody, I am trying to implement a custom image gallery. It has a very distinct design though, It supports drag and drop reordering. Each item has a button on the left and a thumbnail. The drag and drop should happen only when we drag the thumbnail
    and drop on the + buttons. I tried a lot of ways but none of them seem to work properly. The design of the list view is as the image below. 
    the first item in the list view looks like this. a button and a thumbnail and the last item looks the same but instead of a thumbnail it has an icon. When the add button is clicked a open file dialog appears and we can insert a thumbnail when the add button
    which is on the left and right of the thumbnail is clicked. When the add button at the end is clicked it adds a thumbnail at the end. How do i implement something like this ? Any help is much appreciated. 
    This is the code that i have for the list view item container.
    <Style TargetType="ListViewItem" x:Key="ContainerStyle" >
    <Setter Property="KeyboardNavigation.IsTabStop" Value="False"/>
    <Setter Property="Template">
    <Setter.Value>
    <ControlTemplate TargetType="{x:Type ListViewItem}">
    <StackPanel Orientation="Horizontal">
    <Button x:Name="AddButton"
    Style="{StaticResource SeparatorButtonStyle}"
    Tag="{TemplateBinding Tag}" AllowDrop="True"
    HorizontalAlignment="Left"
    Click="AddBtn_Clicked" VerticalAlignment="Center" Margin="10,0,10,0"/>
    <Border x:Name="Bd" BorderBrush="Transparent" BorderThickness="5" Background="{TemplateBinding Background}" Margin="10,10,10,15" SnapsToDevicePixels="true">
    <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
    </Border>
    </StackPanel>
    <ControlTemplate.Triggers>
    <Trigger Property="IsSelected" Value="true">
    <Setter Property="Background" TargetName="Bd" Value="#098ae4" />
    </Trigger>
    <Trigger Property="IsEnabled" Value="false">
    <Setter Property="Background" TargetName="Bd" Value="#098ae4" />
    </Trigger>
    </ControlTemplate.Triggers>
    </ControlTemplate>
    </Setter.Value>
    </Setter>
    <Setter Property="IsSelected" Value="False" />
    </Style>
    The datatemplate looks like this..
    <DataTemplate DataType="{x:Type local:ThumbData}">
    <Border BorderThickness="3,3,3,3" x:Name="thumbnailborder" PreviewMouseMove="MouseOverImage" MouseLeave="thumbnailborder_MouseLeave_1" AllowDrop="True" Tag="{Binding ThumbNumber}" DataContext="{Binding}" Width="150" PreviewMouseDown="Page_PreviewMouseDown" PreviewStylusDown="Page_PreviewStylusDown">
    <StackPanel x:Name="border" Background="LightGray">
    <Border>
    <Grid>
    <Border x:Name="transpBk" Height="{Binding ActualHeight, ElementName=thumbImage}" Width="{Binding ActualWidth, ElementName=thumbImage}" VerticalAlignment="Center" HorizontalAlignment="Center" />
    <Image x:Name="thumbImage" Source="{Binding ImageSource}" VerticalAlignment="Center" HorizontalAlignment="Center" Stretch="Uniform" Width="150" Height="100" />
    </Grid>
    </Border>
    <Border Width="150" Height="20" x:Name="ThumbnailNumberPanel">
    <Border Background="{Binding PColor}" Opacity="0.8" Width="150" HorizontalAlignment="Center" Height="20">
    <TextBlock Text="{Binding ThumbNumber}" TextWrapping="NoWrap" TextTrimming="WordEllipsis" VerticalAlignment="Center"
    HorizontalAlignment="Center" FontFamily="Segoe UI" Foreground="White" FontSize="11" TextAlignment="Center"
    Width="150" Margin="0" PreviewMouseDown="Page_PreviewMouseDown" PreviewStylusDown="Page_PreviewStylusDown"/>
    </Border>
    </Border>
    </StackPanel>
    </Border>
    </DataTemplate>
    Thanks and Regards, JohnnyWalker.

    Hello Johnny,
    Can you describe what do you mean by say this:
    "we can insert a thumbnail and dropped on to the add button which is on the left and right of the thumbnail"
    And also could you describe in which part you have problem?
    If you don't know how to add a image to your listviewitem, please try check VisualTreeHelper Class, use it to the specific element you need and then add the element, like a image to it.
    See a code sample about it:http://rachel53461.wordpress.com/2011/10/09/navigating-wpfs-visual-tree/
    And check for details from MSDN:http://msdn.microsoft.com/en-us/library/system.windows.media.visualtreehelper(v=vs.110).aspx
    Best regards,
    Barry
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.
    Hi Barry, Sorry that was a typo. What i meant to say was we can insert a new thumbnail when the + button which are on either side of the thumbnail is clicked.
    There are two problems that i am facing.
    How do i do drag and drop by dropping on to the + buttons? Drag and drop should not work when one thumbnail is dropped on to the other. Multiple thumbnails can be selected and dragged and dropped to reorder. The + buttons should not be dragged nor
    selected.
     Dragging the last "add thumbnail" should not be possible. It has to be there always at the end. And user should not be able to select, reorder or delete it.
    I have a class which holds the thumbnail and i am setting the observable collection as the item source of the list view. i do not have any problem in showing the thumbnails.
    Thanks and Regards, JohnnyWalker.

  • How can I implement multiple windows/tabs in my Main-Menu?

    I don't really know how to explain it. As an example, Skype has roughly 20 windows bundled with it, that are switched to when you click things like "Skype-Home" and "Profile". The layout changes too drastically to change the way it looks through just code, and it's not a new window being opened, it stays in the same window, the same main-window. I was wondering if this is possible through Cocoa-Applescript, and if so, what are the necessary steps to achieve this.
    Taking it one step further, and if the above is possible, how could I implement a "tab" system in the application? The image below is an example of what I mean.

    AppleScriptObjC can use pretty much everything in the Cocoa API, so yes, it is possible.
    Note that a view is not the same as a window, and a window can have multiple views. There are also many ways to implement "tabs";  take a look at some of Apple's applications - they use various mixtures of toolbars, checkboxes, and radio buttons, for example.  An application such as this will be a lot more involved than what you have done so far though, using custom classes and subclassing existing ones, so be prepared to do a lot of reading and researching.

  • How can we use Custom MessageBox in SelectionChangedEvent of LongListSelector for Windows Phone 8

    Dear Sir/Madam,
    How can we use Custom MessageBox in SelectionChangedEvent of LongListSelector for Windows Phone 8.
    Actually my problem is that When i am using Custom  MessageBox in SelectionChangedEvent of LongListSelector,when i am click Open(Left Button) it's working fine and navigated correctly,But when i am Click the No(Right Button) then it stayed in same page
    but all that page is in stuckup i mean that page is not working and not doing any event.
    My C#.net Code
    private async void userPageLongListSelector_SelectionChanged(object sender, SelectionChangedEventArgs e)
    if (e.AddedItems.Count > 0)
    if (userPageLongListSelector.SelectedItem == null)
    return;
    if (dbTenMin == null)
    dbTenMin = new Database(ApplicationData.Current.LocalFolder, "tenMInDBSchema.db");
    await dbTenMin.OpenAsync();
    var res = (sender as LongListSelector).SelectedItem as _10Min._10MinClass.minUserPages;
    var resIndex = (sender as LongListSelector).ItemsSource.IndexOf(userPageLongListSelector.SelectedItem);
    string selectedPageName = res.userPages.ToString();
    string selectedPageDesignUser = res.pageDesignUser.ToString();
    int selectedIndex = resIndex;
    CustomMessageBox messageBox = new CustomMessageBox()
    Caption = "Message...!",
    Message = "This form need offline datalist,Please load now.",
    LeftButtonContent = "Open",
    RightButtonContent = "No"
    messageBox.Dismissed += (s1, e1) =>
    switch (e1.Result)
    case CustomMessageBoxResult.LeftButton:
    string uidAndpwd = _10MinClass._10MinStaticClass.csUidAndPwd.ToString();
    _10MinClass._10MinStaticClass.csDataListPageDetails = selectedPageDataDetailsForSchema.ToString();
    _10MinClass._10MinStaticClass.csAllDataLists = offlineDataBaseDataListNam;
    _10MinClass._10MinStaticClass.csNotCreatedSchemaNameOfDBList = notCreatedDataLists;
    userPageLongListSelector.SelectedItem = null;
    if (dbTenMin != null)
    dbTenMin.Dispose();
    dbTenMin = null;
    NavigationService.Navigate(new Uri("/10MinformDataList.xaml", UriKind.Relative));
    else
    NavigationService.Navigate(new Uri("/10MinformDataList.xaml", UriKind.Relative));
    break;
    case CustomMessageBoxResult.RightButton:
    break;
    case CustomMessageBoxResult.None:
    break;
    default:
    break;
    messageBox.Show();
    Same custom messagebox code working in Phone_BackKeyPress event i am writing the code in Right Button that e.OriginalSource.ToString(); then it is working fine.
    But It is not working in Selection Changed Event in LongListSelector control in Windows Phone 8.
    Please help me,as soon as possible.
    Thanks & Regards,
    SrinivaaS.

    What happens if you leave the implementation for LeftButton empty as well , does the page gets stuck in that case also, if you press left button?
    i.e.
    CustomMessageBox messageBox = new CustomMessageBox()
    Caption = "Message...!",
    Message = "This form need offline datalist,Please load now.",
    LeftButtonContent = "Open",
    RightButtonContent = "No"
    messageBox.Dismissed += (s1, e1) =>
    switch (e1.Result)
    case CustomMessageBoxResult.LeftButton:
    break;
    case CustomMessageBoxResult.RightButton:
    break;
    case CustomMessageBoxResult.None:
    break;
    default:
    break;
    messageBox.Show();
    http://developer.nokia.com/community/wiki/Using_Crypto%2B%2B_library_with_Windows_Phone_8

  • How to create a custom tag for a custom converter

    In Jdeveloper 11g, I have a project where I have created a custom converter class that impements the javax.faces.convert.Converter class. I have registered the converter with an id in the faces-config.xml file of the project, and the converter works fine by using the <f:converter type="myconverter"> tag. However, the custom converter has a field which I would like to set from the tag itself. Hence, I would like to add an attribute to <f:converter> tag if possible or create a custom tag that has the attribute.
    I have done some reserach and I found that a custom tag can be implemented: I need to create a class which extends from the ConverterTag class or javax.faces.webapp.ConverterElTag class, which I did, but I also need to create ".tld" (tag library) file which defines the tag itself.
    The part about creating the ".tld" file and registring the new tag is what I'm not sure how to do.
    Does someone know how to do this?
    thank you

    Hi frank,
    that's a good document, and it explains how to make a custom converter. I already created the custom converter, it converts a number to any currency pattern. I know java already has a currency converter, but it doesn't support Rupee currency format, and I need that format.
    My converter works, but I would like to pass the pattern of the format through an attribute in a tag. Since f:converter doesn't seem to support that, I created a custom tag which uses my converter, and it enables me to pass a pattern to the converter.
    All of that works, but I need to be able to pass the pattern as an EL expression, and it's not evaluating the expression before passing it to the converter. It just passes the whole expression as a string. I'm thinking It may be something I'm doing wrong.
    this is the tag library definition file:
    <!DOCTYPE taglib
    PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
    "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
    <taglib>
    <tlib-version>1.2</tlib-version>
    <jsp-version>2.1</jsp-version>
    <short-name>custom</short-name>
    <uri>custom-currency-converter</uri>
    <description>
    custom currency custom tag library
    </description>
    <tag>
    <name>CurrencyConverter</name>
    <tag-class>
    converter.Tag.CurrencyConverterTag
    </tag-class>
    <body-content>JSP</body-content>
    <attribute>
    <name>pattern</name>
    <type>java.util.String</type>
    <required>true</required>
    <rtexprvalue>true</rtexprvalue>
    </attribute>
    </tag>
    </taglib>
    Edited by: Abraham Ciokler on Feb 4, 2011 11:20 AM

  • How to add a custom button in WD screen to call a workflow in siebel?

    Hi All,
    We have a requirement to have a custom button at the summary screen(after the rule execution) "Create Opportunity", on clicking on it a new opportunity record should be created in Siebel. As we know the "Save" link calls "PolicyAutomationSaveSession" inbound web service method and saves the information in session table and we can modify the PreSession and PostSession workflows. But we are not sure how it calls the service method and where is the mapping defined.
    Can you please help me on how to add a custom button and how to invoke a workflow in siebel side to implement this requirement?
    Also is there any document which can help me to add a custom button in screen and to add the code behind the button?
    Thanks in advance!!
    Regards,
    Subhradeep

    Subhradeep,
    Closing a Web Determinations window is essentially the same as closing any HTML window. It involves javascript, which you would have to add to the Web Determinations templates.
    Essentially the javascript command to close a window is {{window.close}} or {{top.close}}
    For timing, you might be able to use the setTimeout function of Javascript (see: http://www.w3schools.com/jsref/met_win_settimeout.asp)
    At the risk of exposing exactly how bad my javascript skills are, I have attached a super-simple html fragment, a page that closes itself after 3 seconds. It may help you get started in the right direction. In general closing a window is a fairly dubious activity and is often not permitted by certain browsers. This html page at least works in Internet Explorer.
    <html>
         <head>
         <script language="JavaScript">
              setTimeout(closeMe, 3000);
              function closeMe() {
                   alert("This window will close");
                   top.close();
         </script>
         </head>
         <body><B>This window will close in three seconds</B></body>
    </html>
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Maybe you are looking for