Wednesday, March 21, 2012

Handle Leak with Domino Server

Run next code as third party program on Domino binaries.

PATH must point to Domino location and Notes.jar must be from Domino.

It will crash Domino server within few minutes. The reason is that Domino has Handle Leak on every create\recycle session. It will free only if Java program will stop.

The same code works correct with Notes Client



There is dummy work around. I am not sure it will stable and appropriate for any

If test will stop without closing notes thread (incorrect closing) then Domino will generate message in the console:

"process ... javaw.exe ... has terminated abnormally" 

In the case of this message begin to showing in the domino console, then handle counts will not rising and this code will work without crash.

Monday, March 5, 2012

Fast fix to Domino Java Syncer

After importing java libraries by Domino Java Syncer 2.1 some agents was not compiled by native DXL importer in some databases. So there is fast fix to compile and sign all java agent in database after export java library with Domino Java Syncer.

Domino Java Syncer 2.1 updated without version change.

Saturday, March 3, 2012

Update of Domino Java Syncer

There is a few improvements to Domino Java Syncer 2.0.

Domino Java Syncer 2.1  and list of changes:

Notes.jar parameter was removed form “eclipse” command

Exported eclipse project will use Lotus Notes JVM. This JVM includes Notes.jar, so there is no need to include this package within special entry.

You will need to add it manually in to the project In the case you will use not Lotus Notes JVM.

“.jar” dependencies have relative path in exported eclipse projects

Full path in dependencies was bad in the case if you will want to move you project to another location or sync it with Version Control system.

So precious path like "C:\eclipse\workspace\MyEmail\lib\mailapi.jar" was changed to "\MyEmail\lib\mailapi.jar"


Do not forget compiler settings

Notes DXL use 1.3 compiler by default (at least 8.5.3 Lotus Notes client). Default compiler will be used In the case of importing DXL. So, if you use some newer Java features as annotation, then Java libraries will not be compiled after importing. You will receive many “NoClassDefFound” issues.

To avoid this, go in to the notes.ini file of LotusNotes client and add “JavaCompilerTarget=1.5” property.

DXL import log

DXL log will be shown in the console for DXL importing operations. 


Friday, February 24, 2012

Export and Import Domino Java libraries

I describe how to export Domino Java Libraries in to Eclipse Projects. Current post will show how to do backward operation  - import Eclipse project in to Domino library.  Within both way you will be able to import\export Domino java libraries in to Eclipse project.



The main reason to do it is to use Control Version on class level but java library level. This application will be very useful if you do many code in the Domino Java libraries and works in team.

Documentation

Feel free to use it

Wednesday, February 22, 2012

"Facebook shares" retrieve in a back end

Sometimes you need to get Facebook shares number of you pages in back end. I was need it for performance reason, it faster to preload this data from Facebook in to Domino document and then show it.

There are two way to do it:

FQL 


You could find examples and explanation following http://developers.facebook.com/docs/reference/fql/link_stat/.

Within FQL you could get shared statistic divided by "share", "like", "comment" and also sum of them.



Graph API


Look http://developers.facebook.com/docs/reference/api/ for"id" query.


Graph API as well as actual "like button" widget shows "total_count" number.  Some people think this is not completely correct, but Facebook developers suppose it's correct.

Example of  read shares from java under the cut

Tuesday, February 14, 2012

Concurrency Lotus Document Processing in Java

Domino have all objects synchronized within session so it does not look a good idea to do something with documents in multiple threads in Domino. Some time you need to do some on document that takes a lot of time out of Domino objects, like read some data from URL and put it to the document. Reading URL source data will take a lot of time there, so it is a good idea to do such task in multiple threads.

Take in to mind this multiple thread test on 50 documents

Only document access operations like computeWithForm:

1 thread: 110 ms
10 thread: 124 ms (looks like the same)

Document access (computeWithForm) and read source from URL:

1 thread: 14330 ms
10 thread: 2369 ms (83 % faster then one thread)

I want to present an special class for easy process documents in multiple threads. It based on ExtendedCollection and NotesExecutorService. Realization is under the cut.


Monday, February 13, 2012

How to run Domino Java agents in Multi threads

You could use ExecutorService for Domino Java for running Domino Java agents in the few threads.

There is only one attention:

You know that code will wait until agent.run() or agent.runOnServer() finish. It looks like this methods using thread.wait() for waiting the end of the task. So interrupt() in NotesExecutorService.NotesTask.stopThread() will interrupt not only the NotesTask thread itself but  agent.run() also.

If you are using ExecutorService for Domino Java for running agents then you need to run task in the synchronized method to avoid calling .stopThread() [read interrupt()] until it waits agent finishing [read agent.run() done] 

Changes under the cut

Friday, February 10, 2012

ExecutorService for Domino Java

ExecutorService is a good to use class, but it have a little problem in domino
http://lotusandjava.blogspot.com/2012/02/take-attention-on-executorservice-in.html

It's nice when company politic allow you to fix it like this
http://www-01.ibm.com/support/docview.wss?uid=swg21279509

If you are not allowed to do it, than you got a little trouble. Fortunately Java is creator friendly language, so you could do ExecutorService himself.

I did NotesExecutorService on the base of next articles:
http://tutorials.jenkov.com/java-concurrency/blocking-queues.html
http://java.dzone.com/news/java-concurrency-thread-pools

Modification NotesExecutorService for run multiple thread agents you could find following link How to run Domino Java agents in Multi threads

NotesExecutorService itself under the cut

Thursday, February 9, 2012

How To: jQuery on demand

jQuery are needs to be loaded on demand some times. There is lot of examples but I will add one more from me.

You could wrrite some functions that needs jQuery, some "function myFunctionWithjQuery(){...}", and call it as "initializeJ('myFunctionWithjQuery')".

"initializeJ" will load jQuery, after that, "myFunctionWithjQuery" will be called.

"initializeJ" under cut