- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- catch alarm in the java native method
Operating System - HP-UX
1819576
Members
2880
Online
109603
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2002 11:35 AM
08-03-2002 11:35 AM
catch alarm in the java native method
Hi,
I have one java interface, the interface uses java native method to call C code. I try to use "alarm()" in the C program. The code is like :
signal(SIGALRM,sig_alarm);
alarm(3);
call network connection;
alarm(0);
But The program (java interface and C program) terminates after there is alarm signal.The operating system is 10.20 in my workstation.
Would someone please tell me how to catch the alarm signal ?
Thanks a lot!
zhiyong
I have one java interface, the interface uses java native method to call C code. I try to use "alarm()" in the C program. The code is like :
signal(SIGALRM,sig_alarm);
alarm(3);
call network connection;
alarm(0);
But The program (java interface and C program) terminates after there is alarm signal.The operating system is 10.20 in my workstation.
Would someone please tell me how to catch the alarm signal ?
Thanks a lot!
zhiyong
My life is now asking and learning, I wish It can change into replying and discussing
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-15-2002 06:33 AM
10-15-2002 06:33 AM
Re: catch alarm in the java native method
Hi zhiyong
It's not possible, java supports no signal model in the virtual machine. The JVM uses signals internally for its operation and so native methods should
generally avoid attempting to send signals or install handlers for signals.
In a simple case such as catching a CNTL C and doing a cleanup, it is possible to launch Java from within a Perl script. The Perl script can catch the CNTL C and then signal the JVM by writing to a socket. The application needs to be written so that it is listening on that socket for the signal.
If you have error when you use system handler
You can avoid this error and proceed with process use the following XX HotSpot runtime option:
-XX:+AllowUserSignalHandlers
This JVM option instructs the JVM not to complain if the native code libraries
install signal handlers.
Regards
It's not possible, java supports no signal model in the virtual machine. The JVM uses signals internally for its operation and so native methods should
generally avoid attempting to send signals or install handlers for signals.
In a simple case such as catching a CNTL C and doing a cleanup, it is possible to launch Java from within a Perl script. The Perl script can catch the CNTL C and then signal the JVM by writing to a socket. The application needs to be written so that it is listening on that socket for the signal.
If you have error when you use system handler
You can avoid this error and proceed with process use the following XX HotSpot runtime option:
-XX:+AllowUserSignalHandlers
This JVM option instructs the JVM not to complain if the native code libraries
install signal handlers.
Regards
I love Java OS
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Learn About
News and Events
Support
© Copyright 2025 Hewlett Packard Enterprise Development LP