Search Results

Search found 6 results on 1 pages for 'gustafc'.

Page 1/1 | 1 

  • MySQL on Windows - how do I set the wait_timeout for connections using named pipes?

    - by gustafc
    I use a MySQL database running on a Windows box, and for performance reasons I'm connecting to it using named pipes. The (Java) application using the database (through Hibernate) can let the connection lie idle for quite a long time, which causes the connection to fail with the following message: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 33 558 297 milliseconds ago. The last packet sent successfully to the server was 33 558 297 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem. autoReconnect unfortunately has no effect (and neither does autoReconnectForPools), but the wait_timeout docs state that wait_timeout only applies "to TCP/IP and Unix socket file connections, not to connections made via named pipes, or shared memory". How can I change the wait_timeout for named pipes?

    Read the article

  • In Netbeans, how do I avoid wsimport rebuilding web service clients every build?

    - by gustafc
    I'm on a project where we use NetBeans (6.8). We use several different web services, which we have added as web service references, and Netbeans auto-generates the Ant wsimport scripts for us. Very handy, with one drawback: The web service clients are recompiled every time ant is invoked. This slows down the build process considerably and has caused the number of sword-related injuries, maimings and deaths to skyrocket. Normally, I'd fix this by changing the wsimport element from <wsimport sourcedestdir="${build.generated.dir}/jax-wsCache/PonyService" destdir="${build.generated.dir}/jax-wsCache/PonyService" wsdl="${wsdl-PonyService}" catalog="catalog.xml" verbose="true"/> to <wsimport sourcedestdir="${build.generated.dir}/jax-wsCache/PonyService" destdir="${build.generated.dir}/jax-wsCache/PonyService" wsdl="${wsdl-PonyService}" catalog="catalog.xml" verbose="true"> <produces dir="${build.generated.dir}/jax-wsCache/PonyService" /> </wsimport> But I can't, 'cause this part of the Ant script is auto-generated. If I right-click the PonyService web service reference and select Edit Web Service Attributes ⇒ wsimport options, I can add attributes to the wsimport element, but not child elements. So: How do I add the produces child element to wsimport other than hacking the auto-generated Ant script? Or more generally: How do I make the NetBeans-generated wsimport not recompile the web service clients every time I build?

    Read the article

  • In Netbeans+Ant, how do I avoid wsimport rebuilding web service clients every build?

    - by gustafc
    I'm on a project where we use NetBeans (6.8). We use several different web services, which we have added as web service references, and Netbeans auto-generates the Ant wsimport scripts for us. Very handy, with one drawback: The web service clients are recompiled every time ant is invoked. This slows down the build process considerably and has caused the number of sword-related injuries, maimings and deaths to skyrocket. Normally, I'd fix this by changing the wsimport element from <wsimport sourcedestdir="${build.generated.dir}/jax-wsCache/PonyService" destdir="${build.generated.dir}/jax-wsCache/PonyService" wsdl="${wsdl-PonyService}" catalog="catalog.xml" verbose="true"/> to <wsimport sourcedestdir="${build.generated.dir}/jax-wsCache/PonyService" destdir="${build.generated.dir}/jax-wsCache/PonyService" wsdl="${wsdl-PonyService}" catalog="catalog.xml" verbose="true"> <produces dir="${build.generated.dir}/jax-wsCache/PonyService" /> </wsimport> But I can't, 'cause this part of the Ant script is auto-generated. If I right-click the PonyService web service reference and select Edit Web Service Attributes ⇒ wsimport options, I can add attributes to the wsimport element, but not child elements. So: How do I add the produces child element to wsimport other than hacking the auto-generated Ant script? Or more generally: How do I make the NetBeans-generated wsimport not recompile the web service clients every time I build?

    Read the article

  • How safe is my safe rethrow?

    - by gustafc
    (Late edit: This question will hopefully be obsolete when Java 7 comes, because of the "final rethrow" feature which seems like it will be added.) Quite often, I find myself in situations looking like this: do some initialization try { do some work } catch any exception { undo initialization rethrow exception } In C# you can do it like this: InitializeStuff(); try { DoSomeWork(); } catch { UndoInitialize(); throw; } For Java, there's no good substitution, and since the proposal for improved exception handling was cut from Java 7, it looks like it'll take at best several years until we get something like it. Thus, I decided to roll my own: (Edit: Half a year later, final rethrow is back, or so it seems.) public final class Rethrow { private Rethrow() { throw new AssertionError("uninstantiable"); } /** Rethrows t if it is an unchecked exception. */ public static void unchecked(Throwable t) { if (t instanceof Error) throw (Error) t; if (t instanceof RuntimeException) throw (RuntimeException) t; } /** Rethrows t if it is an unchecked exception or an instance of E. */ public static <E extends Exception> void instanceOrUnchecked( Class<E> exceptionClass, Throwable t) throws E, Error, RuntimeException { Rethrow.unchecked(t); if (exceptionClass.isInstance(t)) throw exceptionClass.cast(t); } } Typical usage: public void doStuff() throws SomeException { initializeStuff(); try { doSomeWork(); } catch (Throwable t) { undoInitialize(); Rethrow.instanceOrUnchecked(SomeException.class, t); // We shouldn't get past the above line as only unchecked or // SomeException exceptions are thrown in the try block, but // we don't want to risk swallowing an error, so: throw new SomeException("Unexpected exception", t); } private void doSomeWork() throws SomeException { ... } } It's a bit wordy, catching Throwable is usually frowned upon, I'm not really happy at using reflection just to rethrow an exception, and I always feel a bit uneasy writing "this will not happen" comments, but in practice it works well (or seems to, at least). What I wonder is: Do I have any flaws in my rethrow helper methods? Some corner cases I've missed? (I know that the Throwable may have been caused by something so severe that my undoInitialize will fail, but that's OK.) Has someone already invented this? I looked at Commons Lang's ExceptionUtils but that does other things. Edit: finally is not the droid I'm looking for. I'm only interested to do stuff when an exception is thrown. Yes, I know catching Throwable is a big no-no, but I think it's the lesser evil here compared to having three catch clauses (for Error, RuntimeException and SomeException, respectively) with identical code. Note that I'm not trying to suppress any errors - the idea is that any exceptions thrown in the try block will continue to bubble up through the call stack as soon as I've rewinded a few things.

    Read the article

  • Does Oracle 11g automatically index fields frequently used for full table scans?

    - by gustafc
    I have an app using an Oracle 11g database. I have a fairly large table (~50k rows) which I query thus: SELECT omg, ponies FROM table WHERE x = 4 Field x was not indexed, I discovered. This query happens a lot, but the thing is that the performance wasn't too bad. Adding an index on x did make the queries approximately twice as fast, which is far less than I expected. On, say, MySQL, it would've made the query ten times faster, at the very least. I'm suspecting Oracle adds some kind of automatic index when it detects that I query a non-indexed field often. Am I correct? I can find nothing even implying this in the docs.

    Read the article

  • In Eclipse, how do I change the default modifiers in the class/type template?

    - by gustafc
    Eclipse's default template for new types (Window Preferences Code Style Code Templates New Java Files) looks like this: ${filecomment} ${package_declaration} ${typecomment} ${type_declaration} Creating a new class, it'll look something like this: package pkg; import blah.blah; public class FileName { // Class is accessible to everyone, and can be inherited } Now, I'm fervent in my belief that access should be as restricted as possible, and inheritance should be forbidden unless explicitly permitted, so I'd like to change the ${type_declaration} to declare all classes as final rather than public: package pkg; import blah.blah; final class FileName { // Class is only accessible in package, and can't be inherited } That seems easier said than done. The only thing I've found googling is a 2004 question on Eclipse's mailing list which was unanswered. So, the question in short: How can I change the default class/type modifiers in Eclipse? I'm using Eclipse Galileo (3.5) if that matters.

    Read the article

1