Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
Message from discussion Shutting down Ebean
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
edge  
View profile  
 More options Oct 18 2009, 2:10 pm
From: edge <e.mcgr...@imilia.com>
Date: Sun, 18 Oct 2009 11:10:30 -0700 (PDT)
Local: Sun, Oct 18 2009 2:10 pm
Subject: Re: Shutting down Ebean
I tried this out and you have to wait a while (1 min exactly as far as
I can tell) for the app to shutdown but it does shutdown cleanly (I
tried this in mvn, java command line and eclipse)
... so I wondering why it takes so long - none of our test cases show
this behaviour - why it takes so long in this case is strange
seem like there is a wait of 1 min somewhere
so a few things I ruled out
1. Its not specific to H2 - I tried MySQL and it also took 1 min
2. Placing the data access code in an extra method @Transactional in
case the app was waiting on a connection to close didn't help either

must be one of the daemon threads that is waiting ... any ideas Rob?

On Oct 18, 5:13 pm, Alex <alxa...@googlemail.com> wrote:

> Hi,
> no, I'm not running the example application. Well, I've decided to
> write a minimalistic howto on start using Ebean, please have a look
> at  http://alxa.wikidot.com/ebean-howto-1for the complete setup.

> Below the main code:

> public class HelloWorld {
>     public static void main(String[] args) {
>         // ### Configuration Objects ###
>         ServerConfig serverConfig = new ServerConfig();
>         DataSourceConfig dataSourceConfig = new DataSourceConfig();

>         // ### Configuration Settings ###
>         // -> data source
>         dataSourceConfig.setDriver("org.h2.Driver");
>         dataSourceConfig.setUsername("howtouser");
>         dataSourceConfig.setPassword("");
>         dataSourceConfig.setUrl("jdbc:h2:db/howto1");

>         // -> server
>         serverConfig.setName("default");
>         serverConfig.setDataSourceConfig(dataSourceConfig);

>         //  auto create db if it does not exist
>         if(!(new File("db/howto1.h2.db")).exists()  ){
>             serverConfig.setDdlGenerate(true);
>             serverConfig.setDdlRun(true);
>             serverConfig.addClass(Hello.class);
>         }

>         EbeanServer eServer = EbeanServerFactory.create(serverConfig);

>         long id = 3;
>         Hello data = eServer.find(Hello.class, id);
>         if (data == null) {
>             System.out.println("This is the first run, saving
> data..");
>             eServer.save(new Hello(id, "Hello World!"));
>         } else {
>             System.out.println(String.format("############\n%s
> \n############", data.getMessage()));
>         }
>         ShutdownManager.shutdown();
>     }

> }

> Thanks in advance

> alx

> On 18 Okt., 02:50, Rob Bygrave <robin.bygr...@gmail.com> wrote:

> > When running the example application you should not need to shutdown H2.

> > It's actually not clear to me what you are doing and what your issue is ...
> > but I'll guess and say you are running the example application ... one of
> > the classes with a main method... and it is hanging / not terminating?

> > I haven't come across any problem like that... is this your issue or am I
> > misunderstanding?

> > Note that Ebean registers with the JVM shutdown hook ... and uses that to
> > close it's resources such as thread pools and Connection pools. It also can
> > trigger a GC to collection profiling information for Autofetch (with a small
> > wait of 100ms from memory).

> > Thanks, Rob.

> > On Sun, Oct 18, 2009 at 5:53 AM, Alex <alxa...@googlemail.com> wrote:

> > > Thanks for the hint.

> > > > some if not all of those threads might belong to H2 so you probably
> > > > need to shout down H2 to get rid of them

> > > So, does anybody knows how can we get a reference to the underlying
> > > database object (in this case I think it is an instance of
> > > org.h2.engine.Database) ? By the way, isn't it something that Ebean
> > > should take care of? I didn't initialize the db, so I shouldn't be
> > > required to shut it down myself.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.