I don't know exactly what the -p does (perhaps it means 'print' and the digit that follows, 1, references stdout), but I suspect it tells jbossvc.exe to not create a service, and instead to just echo the text, and possibly other info, to the run.log.
Taking input from the lock file causes the file to be locked. This prevents the app server from being started twice (the second attempt to run it would pause waiting for the file to become available).
If you are attempting to run two JBoss AS services, then you need to rename a lot of things in the file to prevent collisions (the r.lock file being just one of them). I have reworked the service.bat file to place all such information at the top of the file where it is easy to change (and have the change reflected throughout the file). I can post a link if you like.
At what point does the file become unlocked? After JBoss is stopped and is that when the second "Jbosssvc.exe -p 1 ..." is run after which lock file is deleted?
Please post the "link" you mentioned.
The r.lock file is locked as long as run.bat is active. Once run.bat exits, the lock is released. Note that this happens before the second jbossvc.exe run.
The link: get the source code for JBoss in Action (http://www.manning.com/jamae) from http://code.google.com/p/jbia/ . In ch15, target 04 generates two services. The source for the service.bat file is at ch15/src/service/windows.