rgansevles:
What is the value of vRow?
A value of -1 also means that the entire foundset is locked.
Hello Rob,
the value is: var vRow = controller.getSelectedIndex();
I have a form function “m_doEdit”:
function m_doEdit() {
//check if current row is locked
var vForm = controller.getName();
var vRow = controller.getSelectedIndex();
var vLockName = vForm + vRow;
if(globals.gm_lock_current_row(vForm,vRow,vLockName)){
//return 'true' locks the row of the foundset
//my code
}
}
The globale function is:
function gm_lock_current_row(vForm,vRow,vLockName) {
// TODO Auto-generated method stub
//locks the current row of vForm
var vLock = databaseManager.acquireLock(forms[vForm].foundset,vRow,vLockName);
if(vLock){
return true;
}
else {
globals.gm_showdialog_warning('i18n:dialog_message_locked_rec','OK',null,null,null);
return false;
}
}
At my first try of the lock functionality I used ‘0’ as value. Not ‘-1’ because the foundset could be thousands of records (rows).
Today I took a look on the servoy-admin. In ‘Locks’ are two entries for locked rows, but the clients doesn’t have locked the row(s) at the moment.
6.158404; locked by detlef@pc018[192.168.1.18:3001] (Servoy Smart Client) at Wed Sep 08 09:57:29 CEST 2010
6.158407; locked by Sandro@pc016[192.168.1.16:3003] (Servoy Smart Client) at Wed Sep 08 10:19:00 CEST 2010
I cannot release the two locks from the servoy-admin site. They are still in the list!?
When the clients fire the “save” or “cancel” functions in the soulution, the globale method will be executed:
function gm_unlock_current_row(vLockName) {
// TODO Auto-generated method stub
return(databaseManager.releaseAllLocks(vLockName))
}
I also have a server error log:
2010-09-08 10:08 RMI TCP Connection(121)-192.168.1.16 ERROR com.servoy.j2db.util.Debug Throwable
com.servoy.j2db.ApplicationException: Record is locked
at com.servoy.j2db.dataprocessing.Zu.performUpdates(Zu.java:744)
at sun.reflect.GeneratedMethodAccessor431.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
at sun.rmi.transport.Transport$1.run(Transport.java:159)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:637)
What is wrong in my functions? Why takes executing the “edit” method with the lock function 20 sec. on a smart client, connected to the servoy app server over Internet?