Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #34440
| Newsgroups | comp.lang.java.programmer |
|---|---|
| Date | 2016-06-02 07:21 -0700 |
| References | <slrnnl0dj5.456.avl@login.logic.tuwien.ac.at> |
| Message-ID | <98c956a8-ae76-415d-9347-2c7ff4e1775a@googlegroups.com> (permalink) |
| Subject | Re: Java program "debugging" itself... |
| From | "comp.lang.coffee" <kirandesai84@gmail.com> |
On Thursday, June 2, 2016 at 8:36:51 AM UTC-5, Andreas Leitgeb wrote: > My application is a server that runs separate tasks as > requested by clients. > > Rarely it happens, that one of the tasks goes awry, due > to some bug in the task's code itself. Latest incident > was a loop that accidentally didn't terminate but grew a > StringBuilder's buffer beyond any bounds. > > Given that there exist some natural "constraints" on these > tasks, like they would *never ever* allocate an array of > more than a million elements (yes, that's a rather low > upper bound), then I'd like to use some debugging-API to > request that any thread trying to "new" any array of > size >= 1,000,000 ought to get e.g. an OutOfMemoryError - > regardless of actually available heap-space. This of > course would include "new" statements happening from > the standard library (like StringBuilder's .append(...) ). > > Does anyone know, whether any VMs offer any (maybe non- > standard) API for applications to "watch" themselves? > > The whole point is that any task may fail, but the show > (i.e. the server) must go on... It looks to me like you could use custom exception handling to solve your problem. You can set the limit configurable so you can update it as required.
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Java program "debugging" itself... Andreas Leitgeb <avl@logic.at> - 2016-06-02 13:36 +0000
Re: Java program "debugging" itself... Martin Gregorie <martin@address-in-sig.invalid> - 2016-06-02 14:17 +0000
Re: Java program "debugging" itself... Andreas Leitgeb <avl@logic.at> - 2016-06-02 15:06 +0000
Re: Java program "debugging" itself... Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-06-02 11:14 -0400
Re: Java program "debugging" itself... Andreas Leitgeb <avl@logic.at> - 2016-06-02 15:43 +0000
Re: Java program "debugging" itself... "comp.lang.coffee" <kirandesai84@gmail.com> - 2016-06-02 07:21 -0700
Re: Java program "debugging" itself... Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-06-02 10:38 -0400
Re: Java program "debugging" itself... Robert Klemme <shortcutter@googlemail.com> - 2016-06-02 22:24 +0200
Re: Java program "debugging" itself... Andreas Leitgeb <avl@logic.at> - 2016-06-02 15:28 +0000
Re: Java program "debugging" itself... Martin Gregorie <martin@address-in-sig.invalid> - 2016-06-02 22:22 +0000
Re: Java program "debugging" itself... Andreas Leitgeb <avl@logic.at> - 2016-06-03 15:58 +0000
Re: Java program "debugging" itself... Wanja Gayk <brixomatic@yahoo.com> - 2016-06-04 21:32 +0200
csiph-web