Listener for Files?
Hi
is there a (kind of) Listener I can use to get notified when a File gets changed, i.e. when it's content is changed?
Thanks for your help.
I found an implementaion for such a kind of "File Listener" on the web. It's based on an interface and a class with inner class. Here's the linsting:
public interface FileChangeListener
public void fileChanged(String Filename);
import java.io.*;
import java.util.*;
import java.net.*;
public class FileMonitor
private static final FileMonitor instance = new FileMonitor();
private Timer timer;
private Hashtable timerEntries;
protected FileMonitor()
// Create timer, run timer thread as daemon.
timer = new Timer(true);
timerEntries = new Hashtable();
public static FileMonitor getInstance()
return instance;
/** Add a monitored file with a FileChangeListener.
* @param listener listener to notify when the file changed.
* @param fileName name of the file to monitor.
* @param period polling period in milliseconds.
public void addFileChangeListener(FileChangeListener listener, String fileName, long period) throws FileNotFoundException
removeFileChangeListener(listener, fileName);
FileMonitorTask task = new FileMonitorTask(listener, fileName);
timerEntries.put(fileName + listener.hashCode(), task);
timer.schedule(task, period, period);
/** Remove the listener from the notification list.
* @param listener the listener to be removed.
public void removeFileChangeListener(FileChangeListener listener, String fileName)
FileMonitorTask task = (FileMonitorTask) timerEntries.remove(fileName + listener.hashCode());
if (task != null)
task.cancel();
protected void fireFileChangeEvent(FileChangeListener listener, String fileName)
listener.fileChanged(fileName);
class FileMonitorTask extends TimerTask
FileChangeListener listener;
String fileName;
File monitoredFile;
long lastModified;
public FileMonitorTask(FileChangeListener listener, String fileName) throws FileNotFoundException
this.listener = listener;
this.fileName = fileName;
this.lastModified = 0;
monitoredFile = new File(fileName);
if (!monitoredFile.exists())
// but is it on CLASSPATH?
URL fileURL = listener.getClass().getClassLoader().getResource(fileName);
if (fileURL != null)
monitoredFile = new File(fileURL.getFile());
else
throw new FileNotFoundException("File Not Found: " + fileName);
this.lastModified = monitoredFile.lastModified();
public void run()
long lastModified = monitoredFile.lastModified();
if (lastModified != this.lastModified)
this.lastModified = lastModified;
fireFileChangeEvent(this.listener, this.fileName);
Similar Messages
-
i have a properties file. I need to monitor for the changes to the file and send intimation to all the files using the properties file. How shall i do it with out modifying the files which are executing it. i.e i need to suspend the execution of the threads and reload the values.
set up a File object that represents the props file.
File f = new File ("propsFile"); On start up, note the lastModified() time
In a low priority thread, keep polling the lastModified() method to check if the file has been reloaded.
Set up an event handler mechanism to notify and call all interested objects that would want to take some action if and when the file's been modified.
ram. -
Hi, i am trying to implement a java program that processes a xml file in a virtual directory. I need to, some how, run a java program that listens for a xml file that is uploaded from one server to a virtual directory on another server where the code is listening. I don't really know where to start with the listening code, and needed some help in the general direction of how to do it. Also i was thinking that when a file is found it is processed using a new thread so that the main thread can carry on listening. Would this be feasible?
Is this more or less what you had in mind?import java.io.*;
public class Monitor1 extends Thread {
private static String path = "D:\\Ready";
private static final int DELAY = 5000; // 5 second delay
public void run() {
while(true) {
try {
File f = new File(path);
File controls[] = f.listFiles();
for (int i=0; i<controls.length; i++) {
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(controls)));
String s = "";
java.util.List al = new java.util.ArrayList();
while((s=br.readLine()) != null) {
al.add(s);
Thread c = new ProcessControl(al, path.substring(0, path.indexOf(File.separator)), controls[i].toString());
c.start();
al = null;
br.close();
controls[i].delete();
sleep(DELAY);
catch (InterruptedException ie) {}
catch (IOException ioe) {}
public static void main(String[] args) {
/* Sets the control file directory (if specified). */
if (args.length > 0) {
path = args[0];
Thread mon = new Monitor1();
mon.start();
class ProcessControl extends Thread {
private static final String fs = File.separator;
private String[] values;
private java.util.ListIterator li;
private String drive = null;
private java.util.List al;
private String file;
ProcessControl(java.util.List al, String drive, String file) {
this.file = file;
this.drive = drive;
this.al = al;
li = al.listIterator();
public void run() {
values = new String[al.size()];
/* Download the file to the server */
downloadFile();
private void downloadFile() {
/* Downloads the file using FTP protocol */
String uid = "????????";
String pswd = "????????";
String server="host";
try {
sun.net.ftp.FtpClient client = new sun.net.ftp.FtpClient();
client.openServer(server);
client.login(uid, pswd);
client.cd("path");
sun.net.TelnetInputStream in = client.get("name of file to be retrieved");
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String s;
while((s=br.readLine()) != null) {
System.out.println(s);
in.close();
catch (IOException ioe) {
ioe.printStackTrace();
Mark -
Connection string in listener log file for loading balance/failover
Hi Experts,
I have 4 node RAC for oracle 10g2 in rad hate 5.0
We creaed service dbsale ( sale1,2 as pr imary and sale3/4 as available) with loading balance/failover.
The remote user created a local TNS as
localmarket =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 155.206.xxx.xx)(PORT = 1521))
(LOAD_BALANCE = OFF)
(CONNECT_DATA = (SERVICE_NAME = dbsale))
From server side, I saw that user send two request connection string. one fail and another is OK.
It seems that fail connecting come from failover/loading balance from dbsale3?
Why do we get two connection string in listener log file?
Which difference is between two connection string?
Where does system change these connection string?
Thanks for your explaining.
Jim
==============listener.log message
[oracle@sale log]$ cat listener_sale.log|grep pmason
15-SEP-2009 13:52:24 * (CONNECT_DATA=(SERVICE_NAME=dbsale)(CID=(PROGRAM=oracle)(HOST=rock)(USER=test ))) * (ADDRESS=(PROTOCOL=tcp)(HOST=161.55.xxx.xx)(PORT=54326)) * establish * dbsale * 0
15-SEP-2009 13:52:25 * (CONNECT_DATA=(SERVICE_NAME=dbsale)(CID=(PROGRAM=oracle)(HOST=rock)(USER=test ))(SERVER=dedicated)(INSTANCE_NAME=sale3)) * (ADDRESS=(PROTOCOL=tcp)(HOST=161.55.xxx.xx)(PORT=54327)) * establish * dbsale * 12520
15-SEP-2009 13:52:30 * (CONNECT_DATA=(SERVICE_NAME=dbsale)(CID=(PROGRAM=oracle)(HOST=rock)(USER=test ))) * (ADDRESS=(PROTOCOL=tcp)(HOST=161.55.xxx.xx)(PORT=54329)) * establish * dbsale* 0
15-SEP-2009 13:52:47 * (CONNECT_DATA=(SERVICE_NAME=dbsale)(CID=(PROGRAM=oracle)(HOST=rock)(USER=test ))) * (ADDRESS=(PROTOCOL=tcp)(HOST=161.55.xxx.xx)(PORT=54332)) * establish * dbsale * 0
15-SEP-2009 13:52:47 * (CONNECT_DATA=(SERVICE_NAME=dbsale)(CID=(PROGRAM=oracle)(HOST=rock)(USER=test ))(SERVER=dedicated)(INSTANCE_NAME=sale3)) * (ADDRESS=(PROTOCOL=tcp)(HOST=161.55.xxx.xx)(PORT=54333)) * establish dbsale 12520
15-SEP-2009 13:52:49 * (CONNECT_DATA=(SERVICE_NAME=dbsale)(CID=(PROGRAM=oracle)(HOST=rock)(USER=test ))) * (ADDRESS=(PROTOCOL=tcp)(HOST=161.55.xxx.xx)(PORT=54334)) * establish * dbsale * 0
Edited by: user589812 on Sep 16, 2009 7:21 AMHi Jim,
I think the best way on this case is create one service with one instance as primary and another 3 as available.
Or use the connect string with two vip addresses, cause the service has two instances and the tnsnames.ora entry has only one.
Cheers,
Rodrigo Mufalani
http://mufalani.blogspot.com -
How to configure multiple listeners to listen for the same instance.
Hello everyone,
I am running oracle database 11g and I want information regarding how to configure multiple listeners to listen for the same database instance. Actually I know how to configure more than one listener but the main thing that I am confused about is when we create listener.ora file, do we have to statically register the database instance with both the listeners or the instance will register itself with both the listeners.
According to my knowledge the instance will register with the listener specified by LOCAL_LISTENER parameter and we cannot have more than one value for this parameter.
Please only give detailed answers with example as I am tired of simple answers with details that I already know.Hello,
Yes, it can make sense to have several listener for one Oracle instance. For instance you may have one listener for the applications another listener for DBA administration tasks as well as one listener dedicated to dataguard broker. It is not possible to have several listeners listening on the same IP and Port.
By default the database try to automatically register to a listener on port 1521. To instruct the instance to register to a specifc list of listeners you can add in the init.ora the local_listener parameter with an alias definition:
i.e
local_listener=MY_SET_OFF_LISTENERS
in your tnsname.ora add an entry called:
MY_SET_OFF_LISTENERS_LOCAL= (ADDRESS_LIST=
(ADRESS=(PROTOCOL=TCP)(HOST=myhostname)(PORT=1530))
(ADRESS=(PROTOCOL=TCP)(HOST=myhostname)(PORT=1531))
(ADRESS=(PROTOCOL=TCP)(HOST=myhostname)(PORT=1532))
In this sample your instance will register to three listeners listening on respectively port 1530, 1531 and 1532
If you want your clients can be balanced over the 3 listeners -
How to configure different listener for each database in 11gR2 RAC
Hi Friends,
Current Prod Setup :
11gR2 (11.2..0.2) RAC on RHEL 5.5 with 3 SCAN Listeners on default 1521 port.
Having 4 databases which are using SCAN-IP and listening on default port only.
As per policy, we have to create separate listeners (on different port) for each database.
like,
DB1 - 1522
DB2 - 1523
DB3 - 1524
DB4 - 1525
Even If I configure 4 listeners using NETCA, how my failover & load balancing will happen using SCAN & Newly Created Listeners ???
Thanks in advance..
Regards,
ManishHi,
I tried on 11gR2 TEST RAC Server to have different listener with different port (1529) for SCAN & Node Listener & tested failover, load-balancing which was successful.
[oracle@ravish5 admin]$ cat listener.ora
LISTENER_A=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_A)))) # line added by Agent
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_A=ON # line added by Agent
[oracle@ravish5 admin]$ ps -ef | grep lsnr
oracle 1985 1 0 00:46 ? 00:00:00 /11g_crs/11.2.0.2/product/home/bin/tnslsnr LISTENER -inherit
oracle 1988 1 0 00:46 ? 00:00:00 /11g_database/11.2.0.2/product/home_1/bin/tnslsnr LISTENER_A -inherit
oracle 2928 1 0 01:00 ? 00:00:00 /11g_crs/11.2.0.2/product/home/bin/tnslsnr LISTENER_SCAN1 -inherit
[oracle@ravish5 admin]$ lsnrctl status LISTENER_A
LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 02-MAY-2012 03:19:35
Copyright (c) 1991, 2010, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_A)))
STATUS of the LISTENER
Alias LISTENER_A
Version TNSLSNR for Linux: Version 11.2.0.2.0 - Production
Start Date 02-MAY-2012 00:46:42
Uptime 0 days 2 hr. 32 min. 54 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /11g_database/11.2.0.2/product/home_1/network/admin/listener.ora
Listener Log File /11g_database/11.2.0.2/diag/tnslsnr/ravish5/listener_a/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_A)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.3.5)(PORT=1529)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.3.16)(PORT=1529)))
Services Summary...
Service "TEST" has 1 instance(s).
Instance "TEST2", status READY, has 1 handler(s) for this service...
Service "TESTXDB" has 1 instance(s).
Instance "TEST2", status READY, has 1 handler(s) for this service...
Service "srvc_test.clover.com" has 1 instance(s).
Instance "TEST2", status READY, has 1 handler(s) for this service...
The command completed successfully
SQL> show parameter listen
NAME TYPE VALUE
listener_networks string
local_listener string (DESCRIPTION=(ADDRESS_LIST=(AD
DRESS=(PROTOCOL=TCP)(HOST=192.
168.3.16)(PORT=1529))))
remote_listener string ravish-scan:1529
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
[oracle@ravish5 admin]$ srvctl config scan_listener
SCAN Listener LISTENER_SCAN1 exists. Port: TCP:1521,1529
[oracle@ravish5 admin]$ srvctl config scan
SCAN name: ravish-scan, Network: 1/192.168.3.0/255.255.255.0/eth0
SCAN VIP name: scan1, IP: /ravish-scan.clover.com/192.168.3.22
[oracle@ravish5 admin]$ srvctl config listener
Name: LISTENER
Network: 1, Owner: oracle
Home: <CRS home>
End points: TCP:1521
Name: LISTENER_A
Network: 1, Owner: oracle
Home: /11g_database/11.2.0.2/product/home_1
End points: TCP:1529
[oracle@ravish5 admin]$ srvctl config service -d TEST -s srvc_test.clover.com
Service name: srvc_test.clover.com
Service is enabled
Server pool: TEST_srvc_test.clover.com
Cardinality: 2
Disconnect: false
Service role: PRIMARY
Management policy: AUTOMATIC
DTP transaction: false
AQ HA notifications: true
Failover type: SELECT
Failover method: BASIC
TAF failover retries: 0
TAF failover delay: 0
Connection Load Balancing Goal: LONG
Runtime Load Balancing Goal: NONE
TAF policy specification: BASIC
Edition:
Preferred instances: TEST1,TEST2
Available instances:
TEST_NEW =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = ravish-scan.clover.com)(PORT = 1529))
(LOAD_BALANCE = yes)
(FAILOVER = ON)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = srvc_test.clover.com)
(FAILOVER_MODE =
(TYPE = SELECT)
(METHOD = BASIC)
Actually different ports for different databases are required to have separation of duties. Once Firewall enabled betwen Client & DB Server only privileged users would have access to particular database.
Regards,
Manish -
How can i use my 3rd Generation iPod as a portable harddrive for files...
now that i have a brand new 5th Generation 60Gig iPod, i want to use my old 3rd Generation iPod as a portable storage devise for files and whatever else. not for listening to music anymore. what do i have to do to make this so?
i can just go ahead and use the firewire cable that came with it right? and will i actually be able to upload files to it, and then download them again? like word documents and photo files or spreadsheet or whatever?
will it be cross platform then? meaning will i be able to take it to my friends pc (i use a mac) and download my resume or spreadsheet or whatever else to his machine (of course i would have to use the usb cable then).
know what i mean? i want to use this think like an external harddrive.
please advise.
iBook and Macbook Pro Mac OS X (10.3) and OSX 10.4 on the MBPi think ipods are generally set to enable disc mode, so you can use it as a storage device, by default (if yours isnt, plug your ipod in, and go into options to select enable disc mode). just connect the ipod with whatever cord it came with to your computer, then look into the m.. is it called "my harddrive" or "harddrive"? and you should see the ipod connected there on the left side of the window with "network" and "music" etc. if you click on the ipod icon, you can drag and drop files into your ipod just as you would any other folder and use it as a harddrive.
the tricky thing is using it for both pc and mac. i think if its formatted for a pc, you can use it on both macs and pcs. but if you have it formatted for a mac, then only macs can read it.
so if you want to use it on your friends pc as well, format your ipod on a pc first so you can use it on both platforms.
chris -
Huge performance differences between a map listener for a key and filter
Hi all,
I wanted to test different kind of map listener available in Coherence 3.3.1 as I would like to use it as an event bus. The result was that I found huge performance differences between them. In my use case, I have data which are time stamped so the full key of the data is the key which identifies its type and the time stamp. Unfortunately, when I had my map listener to the cache, I only know the type id but not the time stamp, thus I cannot add a listener for a key but for a filter which will test the value of the type id. When I launch my test, I got terrible performance results then I tried a listener for a key which gave me much better results but in my case I cannot use it.
Here are my results with a Dual Core of 2.13 GHz
1) Map Listener for a Filter
a) No Index
Create (data always added, the key is composed by the type id and the time stamp)
Cache.put
Test 1: Total 42094 millis, Avg 1052, Total Tries 40, Cache Size 80000
Cache.putAll
Test 2: Total 43860 millis, Avg 1096, Total Tries 40, Cache Size 80000
Update (data added then updated, the key is only composed by the type id)
Cache.put
Test 3: Total 56390 millis, Avg 1409, Total Tries 40, Cache Size 2000
Cache.putAll
Test 4: Total 51734 millis, Avg 1293, Total Tries 40, Cache Size 2000
b) With Index
Cache.put
Test 5: Total 39594 millis, Avg 989, Total Tries 40, Cache Size 80000
Cache.putAll
Test 6: Total 43313 millis, Avg 1082, Total Tries 40, Cache Size 80000
Update
Cache.put
Test 7: Total 55390 millis, Avg 1384, Total Tries 40, Cache Size 2000
Cache.putAll
Test 8: Total 51328 millis, Avg 1283, Total Tries 40, Cache Size 2000
2) Map Listener for a Key
Update
Cache.put
Test 9: Total 3937 millis, Avg 98, Total Tries 40, Cache Size 2000
Cache.putAll
Test 10: Total 1078 millis, Avg 26, Total Tries 40, Cache Size 2000
Please help me to find what is wrong with my code because for now it is unusable.
Best Regards,
Nicolas
Here is my code
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import com.tangosol.io.ExternalizableLite;
import com.tangosol.net.CacheFactory;
import com.tangosol.net.NamedCache;
import com.tangosol.util.Filter;
import com.tangosol.util.MapEvent;
import com.tangosol.util.MapListener;
import com.tangosol.util.extractor.ReflectionExtractor;
import com.tangosol.util.filter.EqualsFilter;
import com.tangosol.util.filter.MapEventFilter;
public class TestFilter {
* To run a specific test, just launch the program with one parameter which
* is the test index
public static void main(String[] args) {
if (args.length != 1) {
System.out.println("Usage : java TestFilter 1-10|all");
System.exit(1);
final String arg = args[0];
if (arg.endsWith("all")) {
for (int i = 1; i <= 10; i++) {
test(i);
} else {
final int testIndex = Integer.parseInt(args[0]);
if (testIndex < 1 || testIndex > 10) {
System.out.println("Usage : java TestFilter 1-10|all");
System.exit(1);
test(testIndex);
@SuppressWarnings("unchecked")
private static void test(int testIndex) {
final NamedCache cache = CacheFactory.getCache("test-cache");
final int totalObjects = 2000;
final int totalTries = 40;
if (testIndex >= 5 && testIndex <= 8) {
// Add index
cache.addIndex(new ReflectionExtractor("getKey"), false, null);
// Add listeners
for (int i = 0; i < totalObjects; i++) {
final MapListener listener = new SimpleMapListener();
if (testIndex < 9) {
// Listen to data with a given filter
final Filter filter = new EqualsFilter("getKey", i);
cache.addMapListener(listener, new MapEventFilter(filter), false);
} else {
// Listen to data with a given key
cache.addMapListener(listener, new TestObjectSimple(i), false);
// Load data
long time = System.currentTimeMillis();
for (int iTry = 0; iTry < totalTries; iTry++) {
final long currentTime = System.currentTimeMillis();
final Map<Object, Object> buffer = new HashMap<Object, Object>(totalObjects);
for (int i = 0; i < totalObjects; i++) {
final Object obj;
if (testIndex == 1 || testIndex == 2 || testIndex == 5 || testIndex == 6) {
// Create data with key with time stamp
obj = new TestObjectComplete(i, currentTime);
} else {
// Create data with key without time stamp
obj = new TestObjectSimple(i);
if ((testIndex & 1) == 1) {
// Load data directly into the cache
cache.put(obj, obj);
} else {
// Load data into a buffer first
buffer.put(obj, obj);
if (!buffer.isEmpty()) {
cache.putAll(buffer);
time = System.currentTimeMillis() - time;
System.out.println("Test " + testIndex + ": Total " + time + " millis, Avg " + (time / totalTries) + ", Total Tries " + totalTries + ", Cache Size " + cache.size());
cache.destroy();
public static class SimpleMapListener implements MapListener {
public void entryDeleted(MapEvent evt) {}
public void entryInserted(MapEvent evt) {}
public void entryUpdated(MapEvent evt) {}
public static class TestObjectComplete implements ExternalizableLite {
private static final long serialVersionUID = -400722070328560360L;
private int key;
private long time;
public TestObjectComplete() {}
public TestObjectComplete(int key, long time) {
this.key = key;
this.time = time;
public int getKey() {
return key;
public void readExternal(DataInput in) throws IOException {
this.key = in.readInt();
this.time = in.readLong();
public void writeExternal(DataOutput out) throws IOException {
out.writeInt(key);
out.writeLong(time);
public static class TestObjectSimple implements ExternalizableLite {
private static final long serialVersionUID = 6154040491849669837L;
private int key;
public TestObjectSimple() {}
public TestObjectSimple(int key) {
this.key = key;
public int getKey() {
return key;
public void readExternal(DataInput in) throws IOException {
this.key = in.readInt();
public void writeExternal(DataOutput out) throws IOException {
out.writeInt(key);
public int hashCode() {
return key;
public boolean equals(Object o) {
return o instanceof TestObjectSimple && key == ((TestObjectSimple) o).key;
}Here is my coherence config file
<?xml version="1.0"?>
<!DOCTYPE cache-config SYSTEM "cache-config.dtd">
<cache-config>
<caching-scheme-mapping>
<cache-mapping>
<cache-name>test-cache</cache-name>
<scheme-name>default-distributed</scheme-name>
</cache-mapping>
</caching-scheme-mapping>
<caching-schemes>
<distributed-scheme>
<scheme-name>default-distributed</scheme-name>
<backing-map-scheme>
<class-scheme>
<scheme-ref>default-backing-map</scheme-ref>
</class-scheme>
</backing-map-scheme>
</distributed-scheme>
<class-scheme>
<scheme-name>default-backing-map</scheme-name>
<class-name>com.tangosol.util.SafeHashMap</class-name>
</class-scheme>
</caching-schemes>
</cache-config>Message was edited by:
user620763Hi Robert,
Indeed, only the Filter.evaluate(Object obj)
method is invoked, but the object passed to it is a
MapEvent.<< In fact, I do not need to implement EntryFilter to
get a MapEvent, I could get the same result (in my
last message) by writting
cache.addMapListener(listener, filter,
true)instead of
cache.addMapListener(listener, new
MapEventFilter(filter) filter, true)
I believe, when the MapEventFilter delegates to your filter it always passes a value object to your filter (old or new), meaning a value will be deserialized.
If you instead used your own filter, you could avoid deserializing the value which usually is much larger, and go to only the key object. This would of course only be noticeable if you indeed used a much heavier cached value class.
The hashCode() and equals() does not matter on
the filter class<< I'm not so sure since I noticed that these methods
were implemented in the EqualsFilter class, that they
are called at runtime and that the performance
results are better when you add them
That interests me... In what circumstances did you see them invoked? On the storage node before sending an event, or upon registering a filtered listener?
If the second, then I guess the listeners are stored in a hash-based map of collections keyed by a filter, and indeed that might be relevant as in that case it will cause less passes on the filter for multiple listeners with an equalling filter.
DataOutput.writeInt(int) writes 4 bytes.
ExternalizableHelper.writeInt(DataOutput, int) writes
1-5 bytes (or 1-6?), with numbers with small absolute
values consuming less bytes.Similar differences exist
for the long type as well, but your stamp attribute
probably will be a large number...<< I tried it but in my use case, I got the same
results. I guess that it must be interesting, if I
serialiaze/deserialiaze many more objects.
Also, if Coherence serializes an
ExternalizableLite object, it writes out its
class-name (except if it is a Coherence XmlBean). If
you define your key as an XmlBean, and add your class
into the classname cache configuration in
ExternalizableHelper.xml, then instead of the
classname, only an int will be written. This way you
can spare a large percentage of bandwidth consumed by
transferring your key instance as it has only a small
number of attributes. For the value object, it might
or might not be so relevant, considering that it will
probably contain many more attributes. However, in
case of a lite event, the value is not transferred at
all.<< I tried it too and in my use case, I noticed that
we get objects nearly twice lighter than an
ExternalizableLite object but it's slower to get
them. But it is very intersting to keep in mind, if
we would like to reduce the network traffic.
Yes, these are minor differences at the moment.
As for the performance of XMLBean, it is a hack, but you might try overriding the readExternal/writeExternal method with your own usual ExternalizableLite implementation stuff. That way you get the advantages of the xmlbean classname cache, and avoid its reflection-based operation, at the cost of having to extend XMLBean.
Also, sooner or later the TCMP protocol and the distributed cache storages will also support using PortableObject as a transmission format, which enables using your own classname resolution and allow you to omit the classname from your objects. Unfortunately, I don't know when it will be implemented.
>
But finally, I guess that I found the best solution
for my specific use case which is to use a map
listener for a key which has no time stamp, but since
the time stamp is never null, I had just to check
properly the time stamp in the equals method.
I would still recommend to use a separate key class, use a custom filter which accesses only the key and not the value, and if possible register a lite listener instead of a heavy one. Try it with a much heavier cached value class where the differences are more pronounced.
Best regards,
Robert -
Hi,
system i am using for Oracle SOA is :
Windows 64 Bit
i5 Processor
6 GB RAM
29 GB on C Drive is already free after installation of all SOA related products.
I have installed wlserver_10.3 for SOA 11g Development purpose and followed exact installation sequence and procedure as mention in oracle documentation
i created domain also and every thing look correct but after installation procedure there are "Additional actions required just after every thing installed" :
setting memory limit
starting weblogic server (Admin Server)
starting weblogic managed server
and so on
now Problem is when i execute C:\Oracle\Middleware\user_projects\domains\soa_div_domain\bin startWebLogic.cmd
as mention in oracle documentation i am getting following error message : (i have only included last error lines instead of complete console log)
oConsole= -Dweblogic.ext.dirs=C:\Oracle\MIDDLE~1\patch_wls1036\profiles\default\
sysext_manifest_classpath;C:\Oracle\MIDDLE~1\patch_oepe180\profiles\default\syse
xt_manifest_classpath;C:\Oracle\MIDDLE~1\patch_ocp371\profiles\default\sysext_ma
nifest_classpath;C:\Oracle\MIDDLE~1\patch_adfr1111\profiles\default\sysext_manif
est_classpath weblogic.Server
Listening for transport dt_socket at address: 8453
Exception in thread "main" java.lang.NoClassDefFoundError: vXmx512m
Caused by: java.lang.ClassNotFoundException: vXmx512m
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: ++Xmx512m. Program will exit.
Now to resolve this what i already tried are :
I change JAVA_HOME and PATH to jdk6 which came with web logic installer
Location is at :
JAVA_HOME : C:\Oracle\Middleware\jdk160_29
PATH : C:\Oracle\Middleware\jdk160_29\bin
The above dose not include any space between path
I ran the startWebLogic.cmd and got same error
After that I also added
CLASSPATH : C:\Oracle\Middleware\jdk160_29\lib\tool.jar;C:\Oracle\Middleware\wlserver_10.3\server\lib\weblogic.jar;C:\Oracle\Middleware\jdk160_29\bin
WL_HOME: C:\Oracle\Middleware\wlserver_10.3
I ran the startWebLogic.cmd and got same error
I also used earlier path which I used with eclipse when I was working on other java development.
JAVA_HOME : C:\Program Files\Java\jdk1.7.0_21
PATH : C:\Program Files\Java\jdk1.7.0_21\bin
I ran the startWebLogic.cmd and got same error
Then I also gave PATH: C:\Oracle\Middleware\wlserver_10.3\server\lib (including the existing one using ; )
I ran the startWebLogic.cmd and got same error
Now may be there is a file called setSOADomainEnv.cmd in
< C:\Oracle\Middleware\user_projects\domains\soa_div_domain\bin\ setSOADomainEnv.cmd>
That include some values for memory set :
set JAVA_OPTIONS=%JAVA_OPTIONS%
set DEFAULT_MEM_ARGS=-Xms512m –Xmx512m
set PORT_MEM_ARGS=-Xms512m –Xmx768m
if "%JAVA_VENDOR%" == "Oracle" goto OracleJVM
set DEFAULT_MEM_ARGS=%DEFAULT_MEM_ARGS% -XX:PermSize=128m -XX:MaxPermSize=768m
set PORT_MEM_ARGS=%PORT_MEM_ARGS% -XX:PermSize=256m -XX:MaxPermSize=768m
now as I change the red highlighted value to 512 value because I have less memory resource and I checked in installation documentation to change the above red highlighted value to 512 original is 1024 which is too high and it was crating problem and showing memory space problem so I change it to 512 and now I am not getting that memory space problem error but may be the above error is related with change value in setSOADomainEnv.cmd file or not
Following are my domain, weblogic and soa home directory path and all these path are exactly what it suppose to be according to Oracle Installation Documentation:
WebLogic :
C:\Oracle\Middleware\wlserver_10.3
C:\Oracle\Middleware\coherence_3.7
C:\Oracle\Middleware\oepe_11.1.1.8.0
SOA Oracle Home Directory :
C:\Oracle\Middleware\Oracle_SOA1
OSB Home Location :
C:\Oracle\Middleware\Oracle_OSB1
Domain name : soa_div_domain
Domain Location : C:\Oracle\Middleware\user_projects\domains
Application Location : C:\Oracle\Middleware\user_projects\applications
Domain Location: C:\Oracle\Middleware\user_projects\domains\soa_div_domain
form here i am trying to start weblogic : C:\Oracle\Middleware\user_projects\domains\soa_div_domain\bin\startWebLogic.cmd
Please tell me any body want more details.
Thanks.I think you are missing a character '-'
USER_MEM_ARGS="Xms512m -Xmx512m -XX:MaxPermSize=128m"Add this character like follows
"-Xms512m -Xmx512m -XX:MaxPermSize=128m" -
Listener.ORA file in a RAC environment. VIP used. Is ithis OK
Dear Sirs:
Environment is - Oracle 10G (10.2.0.3.0) running on RHEL 4.0 for Intel Itanium, two node RAC
The listener.ora file is as follows
LISTENER_MYDB1 =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = mydb1-vip)(PORT = 1521)(IP = FIRST))
(ADDRESS = (PROTOCOL = TCP)(HOST = *192.168.1.10*)(PORT = 1521)(IP = FIRST))
SID_LIST_LISTENER_MYDB1 =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /oracle/ora10g/product/1020/db_1)
(PROGRAM = extproc)
INBOUND_CONNECT_TIMEOUT_LISTENER_MYDB1=110I am seeing that the VIP is used. Is this OK or should the public IP be used?? Everymonth during high activity the listener simply refused connection.
Please help.
regards,
CaesarI am seeing that the VIP is used. Is this OK or should the public IP be used?? yes,its ok to use both.
Everymonth during high activity the listener simply refused connection. whats the error msg you getting ,check log file for more detail. -
Listener name in the listener.ora file is getting change from GPROD to %s_
Dear Experts,
Please note that after doing the R12.1 upgrade, When i bounce the database i have noted that my database listener name in the listener.ora file is getting change from GPROD to %s_db_listener%. Again every time after changeing the listener log file i am able to start the listener.
Please advise.
[oracle@upgrade 11.2.2]$ lsnrctl start GPROD
LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 07-OCT-2011 10:07:33
Copyright (c) 1991, 2010, Oracle. All rights reserved.
Starting /u04/d01/tech_st/11.2.2/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.2.0 - Production
System parameter file is /u04/d01/tech_st/11.2.2/network/admin/GPROD_upgrade/listener.ora
Log messages written to /u04/d01/tech_st/11.2.2/log/diag/tnslsnr/upgrade/gprod/alert/log.xml
TNS-01151: Missing listener name, GPROD, in LISTENER.ORA
Listener failed to start. See the error message(s) above...
[oracle@upgrade 11.2.2]$ vi /u04/d01/tech_st/11.2.2/log/diag/tnslsnr/upgrade/gprod/alert/log.xml
[oracle@upgrade 11.2.2]$ cd network/admin/GPROD_upgrade/
[oracle@upgrade GPROD_upgrade]$ ls
listener_ifile.ora listener.ora listener.ora_bkpaug2911 sqlnet_ifile.ora sqlnet.ora tnsnames.ora
[oracle@upgrade GPROD_upgrade]$ vi listener.ora
(SID_DESC =
(ORACLE_HOME= /u04/d01/tech_st/11.2.2)
(SID_NAME = GPROD)
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u04/d01/tech_st/11.2.2)
(PROGRAM = extproc)
STARTUP_WAIT_TIME_%s_db_listener% = 0
CONNECT_TIMEOUT_%s_db_listener% = 10
TRACE_LEVEL_%s_db_listener% = OFF
LOG_DIRECTORY_%s_db_listener% = /u04/d01/tech_st/11.2.2/network/admin
LOG_FILE_%s_db_listener% = %s_db_listener%
TRACE_DIRECTORY_%s_db_listener% = /u04/d01/tech_st/11.2.2/network/admin
TRACE_FILE_%s_db_listener% = %s_db_listener%
ADMIN_RESTRICTIONS_%s_db_listener% = OFF
IFILE=/u04/d01/tech_st/11.2.2/network/admin/GPROD_upgrade/listener_ifile.oraStep 1- Run the autoconfig on the db tier.
Step -2 Automatically it is changing the setting in the database listener log file and it is showing 4 database listeners are up .
[oracle@upgrade 11.2.2]$ ps -ef |grep inh
oracle 756 1 0 11:01 ? 00:00:00 /u04/d01/tech_st/11.2.2/bin/tnslsnr GPROD -inherit
oracle 757 756 0 11:01 ? 00:00:00 /u04/d01/tech_st/11.2.2/bin/tnslsnr GPROD -inherit
oracle 758 757 0 11:01 ? 00:00:00 /u04/d01/tech_st/11.2.2/bin/tnslsnr GPROD -inherit
oracle 759 757 0 11:01 ? 00:00:00 /u04/d01/tech_st/11.2.2/bin/tnslsnr GPROD -inherit
oracle 1721 31038 0 11:02 pts/2 00:00:00 grep inh
applmgr 31380 1 0 10:53 ? 00:00:00 /u04/d02/apps/tech_st/10.1.2/bin/tnslsnr APPS_GPROD -inherit
Step - 3
Again down the apps tier services.
Step -4
Reset the listener.ora file in the database tier
Please advise.
Regards
Mohammed. -
Different listener log file in RAC system
we have 4 nodes 11.1.0.7 RAC at redhat 5.1 linux system.
I just find there are two listener log file (listener.log; listener_nodename.log ) in each node.
I want to know which difference function is in both listener.log and listener_nodename.log?
When or which condition does node run( record data) in listener.log?
When or which condition does node run( record data) in listener_nodename.log
I saw the 3 node3 listener_nodename.log is wroking on and one node listener.log is workig on.
why?
Does some experts explain this point for me?
ThanksI make some clears for this requirements.
we have a schedule backup and stores in ASM diskgroup in SAN.
As system admin and policy of SAN disaster recovery, we need to generate backup in a local file system.
in this case, we only backup database plus archival files in external file system. but I still saw snapshot control file is still put into default linux location.
I am not able to see this snapshot in external file system.
For SAN disaster recovery, do we need to save a control file snapshot in external file?
Can I apply BACKUP CURRENT CONTROLFILE TO DESTINATION "external file path" for SAN disaster recovery?
Thanks in advance!
Jin -
Oracle 11g - Listen for remote connections
Hi all,
I recently installed Oracle 11.1.0.7.0 on a Windows Server 2008 standard server 6.0 service pack 2. Everything is working as it should.
I can open the database control web page on the local computer.
I can connect locally to the database from SQL Plus
I can connect locally to the database from Oracle SQL Developer
The database control web page shows the database is up and running as well as the listener. All is good! As the status shows:
C:\>lsnrctl status
LSNRCTL for 32-bit Windows: Version 11.1.0.7.0 - Production on 11-APR-2012 07:24
:02
Copyright (c) 1991, 2008, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
Alias LISTENER
Version TNSLSNR for 32-bit Windows: Version 11.1.0.7.0 - Produ
ction
Start Date 10-APR-2012 16:58:34
Uptime 0 days 14 hr. 25 min. 33 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File F:\app\oracle\product\11.1.0\db_2\network\admin\listen
er.ora
Listener Log File f:\app\oracle\diag\tnslsnr\SLOTH\listener\alert\log.xm
l
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1521ipc)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=SLOTH.qmuzik.local)(PORT=1521)))
Services Summary...
Service "qmzorcl" has 1 instance(s).
Instance "qmzorcl", status READY, has 1 handler(s) for this service...
Service "qmzorclXDB" has 1 instance(s).
Instance "qmzorcl", status READY, has 1 handler(s) for this service...
Service "qmzorcl_XPT" has 1 instance(s).
Instance "qmzorcl", status READY, has 1 handler(s) for this service...
The command completed successfullyBut when I open Oracle SQL Developer from another PC and try to connect, I am unable to do so!
I keep getting the following error:
Status: Failure - Test failed: IO Error: The Network Adapter could not establish the connection.What do I need to do, so that I can connect from a remote computer?
Can anyone please assist me in this matter?
Many thanks in advance!
Kind regards,
RichardVishwanath wrote:
Open Listener .ora and tnsnames .ora on server and match the below parameters with the connection form of SQL developer.Check one by one they should match to establish the connection to the database.
HOSTNAME, PORTNUMBER and SERVICE_NAME.Hi,
Many thanks for the response! I am sure that the connection parameters are correct.
Client PC:
Hostname: SLOTH.qmuzik.local
Port: 1521
SID: qmzorcl (I even tried the QMZORCL - but that did not make a difference)
Server listener.ora File:
# listener.ora Network Configuration File: F:\app\oracle\product\11.1.0\db_2\network\admin\listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = SLOTH.qmuzik.local)(PORT = 1521))
Server tnsnames.ora File:
# tnsnames.ora Network Configuration File: F:\app\oracle\product\11.1.0\db_2\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
QMZORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = SLOTH.qmuzik.local)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = qmzorcl)
)Any suggestions?
Thanks again! -
DB13c Error:ORA-12541: TNS:no listener for windows systems
Hello Gurus,
We are facing an issue in DB13C jobs.
Background:
DB13c is setup in Solution Manager.
Only for windows systems DB13 jobs are failing.
Job log is given below:
Job started
Step 001 started (program RSDBAJOB, variant &0000000002249, user ID P96ADM)
Execute logical command BRCONNECT On host 10.91.26.117
Parameters:-u / -jid CHECK20120116070805 -sid T72 -j P96 -c -f check
BR0801I BRCONNECT 7.10 (20)
BR0280I BRCONNECT time stamp: 2012-01-16 07.08.09
BR0301W SQL error -12541 at location BrDbConnect-15, SQL statement:
'CONNECT / AT JOURNAL_DB USING P96'
ORA-12541: TNS:no listener
BR0310W Connect to database instance P96 failed
BR0477I Oracle pfile /oracle/T72/102_64/dbs/initT72001.ora created from spfile /oracle/T72/102_64/dbs/spfileT72001.ora
BR0805I Start of BRCONNECT processing: cehrfhfs.chk 2012-01-16 07.08.08
BR0484I BRCONNECT log file: /oracle/T72/sapcheck/cehrfhfs.chk
BR0280I BRCONNECT time stamp: 2012-01-16 07.08.09
BR0301E SQL error -12541 at location db_connect-7, SQL statement:
'CONNECT / AT JOURNAL_DB USING P96'
ORA-12541: TNS:no listener
BR0310E Connect to database instance P96 failed
BR0280I BRCONNECT time stamp: 2012-01-16 07.08.09
BR0301W SQL error -3114 at location brc_dblog_open-3, SQL statement:
'/* AT JOURNAL_DB */ INSERT INTO SAP_SDBAH (BEG, FUNCT, SYSID, OBJ, RC, ENDE, ACTID, LINE) VALUES ('20120116070808', 'chk', 'T72
ORA-03114: not connected to ORACLE
BR0324W Insertion of database log header failed
BR0806I End of BRCONNECT processing: cehrfhfs.chk2012-01-16 07.08.09
BR0280I BRCONNECT time stamp: 2012-01-16 07.08.09
BR0804I BRCONNECT terminated with errors
External program terminated with exit code 3
Internal session terminated with a runtime error (see ST22)
Job cancelled
P96 is our solman(version:SAP EHP 1 for SAP Solution Manager 7.0)
T72 is 4.6c System .
Sap in windows
Database in Linux
Oracle -10.2.0.4
rest all DB13 jobs are running fine.
Only for windows system we are facing issue now.
Runtime Error which comes along with it is:
OBJECTS_OBJREF_NOT_ASSIGNED
Access via 'NULL' object reference not possible.
The current ABAP program "RSDBAJOB" had to be terminated because it has
come across a statement that unfortunately cannot be executed.
lsnrctl status for t72 instance is giving result for another instance(A72 which is teh Acceptance system for T72)
orat72 51> lsnrctl status
LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 16-JAN-2012 07:27:53
Copyright (c) 1991, 2007, Oracle. All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
Alias LISTENER_A72_ES1UL0017
Version TNSLSNR for Linux: Version 10.2.0.4.0 - Production
Start Date 27-DEC-2011 14:53:43
Uptime 19 days 16 hr. 34 min. 9 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/A72/102_64/network/admin/listener.ora
Listener Log File /oracle/A72/102_64/network/log/listener_a72_es1ul0017.log
Kindly provide your valuable suggestions.
Regards,
SamayaHello Nicholas,
Thank you for your suggestion.
But i do not think it is really required to change P96 tnsnames.ora.
Because, T72 database is in a Linnux box where several other DB are also there.
(Our landscape,NOn-PRD DB instances are together in 1 linux box)
DB13 jobs of other instances are working fine.
Only difference is T72 sap instace is a windows server where as other instances are in AIX.
In DB13c, windows system is configured as without ABAP server .
UNIX systems as With ABAP server.
All were working with this configuration till few days ago.
Thank you. -
R12 upgrade , after 6678700, started services, listener.ora file missing
Hi ,
1)- Upgrading to r12 from 10.5.10.2
2)- 6678700 completed (so far just for US, not NLS).
3)-Just for testing purpose , when started services, got following errors related to listener.ora.
Please help.
Executing service control script:
/u01/oracle/inst/apps/TEST_epiktest/admin/scripts/adalnctl.sh start
script returned:
adalnctl.sh version 120.3
Checking for FNDFS executable.
Starting listener process APPS_TEST.
adalnctl.sh: exiting with status 1
adalnctl.sh: check the logfile /u01/oracle/inst/apps/TEST_test/logs/appl/admin/log/adalnctl.txt for more information ...
.end std out.
grep: /u01/oracle/inst/apps/TEST_test/ora/10.1.2/network/admin/listener.ora: No such file or directory
.end err out.grep: /u01/oracle/inst/apps/TEST_test/ora/10.1.2/network/admin/listener.ora: No such file or directoryPlease run AutoConfig and make sure it completes successfully -- AutoConfig will create the listener.ora file for you.
Thanks,
Hussein
Maybe you are looking for
-
Horizontal Spry Menu Bar with Horizontal Sub Menu
I have created a horizontal menu bar with only one main menu item leading to a sub menu. I would like this sub menu to display horizontally also, instead of vertically as added by default. I am relatively new to dreamweaver and would appreciate any h
-
Folder action to find and replace text and change line feeds
I want to use a folder action to find and replace text and change Mac carriage returns to DOS line feeds inside text files. The text to be replaced is: "/Users/wim/Music/iTunes/iTunes Music/Music" (without the quotes) This text has to be removed (i.e
-
iTunes does not recognize my iPhone anymore. I cannot sync it either! This is so frustrating!!!!
-
Hi To all, I'm implementing MSS 60.1.5 <b>(No WebDynpro)</b> I have a problem with GeneraData iView (com.sap.pct.hcm.eeprofilegeneraldata.default) It's a JSP and it utilize the RFC HRWPC_RFC_EP_READ_GENERALDATA The problem is that the iView do not sh
-
After installing Mountain Lion doesn't external hard drives mount or stay mounted. I have tried resetting my Mac's PRAM but the problem still remains. Even USB memory sticks are unmounted efter a few seconds. Anybody else with this major problem?