You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by "White, Tim" <Ti...@qwest.com> on 2007/05/01 22:59:34 UTC

Multiple Velocity Engines?

Is there a way to initialize several velocity engines?  i.e. multiple
singletons?
 
Tim


This communication is the property of Qwest and may contain confidential or
privileged information. Unauthorized use of this communication is strictly 
prohibited and may be unlawful.  If you have received this communication 
in error, please immediately notify the sender by reply e-mail and destroy 
all copies of the communication and any attachments.

Re: Multiple Velocity Engines?

Posted by mailmur <ma...@yahoo.com>.
Probably he should make own singleton wrapper and
instantiate VelocityEngine per use. Don't have example
available atm, but creating own VelocityEngine
instance was just to give constructor Properties
instance and its done. This allows different
.properties settings for each engine instance.

public class MyVMEngines {
  private static engine1, engine2;

  public static synchronized VE getEngine1() {
   ...code here...
   return engine1;
  }

  public static synchronized VE getEngine2() {
   ...code here...
   return engine2;
  }
}

--- Lee van der Veen <lv...@gmail.com> wrote:
> I believe having multiple singletons would involve
> having multiple  
> class loaders.  You may want to look in that
> direction if you really  
> need singletons.
> 
> Lee
> 
> On 1-May-07, at 3:59 PM, White, Tim wrote:
> 
> > Is there a way to initialize several velocity
> engines?  i.e. multiple singletons?
> >
> > Tim


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


Re: Multiple Velocity Engines?

Posted by Lee van der Veen <lv...@gmail.com>.
I believe having multiple singletons would involve having multiple  
class loaders.  You may want to look in that direction if you really  
need singletons.

Lee

On 1-May-07, at 3:59 PM, White, Tim wrote:

> Is there a way to initialize several velocity engines?  i.e. multiple
> singletons?
>
> Tim
>
>
> This communication is the property of Qwest and may contain  
> confidential or
> privileged information. Unauthorized use of this communication is  
> strictly
> prohibited and may be unlawful.  If you have received this  
> communication
> in error, please immediately notify the sender by reply e-mail and  
> destroy
> all copies of the communication and any attachments.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


Re: Multiple Velocity Engines?

Posted by Nathan Bubna <nb...@gmail.com>.
multiple singletons is an oxymoron.   :)  you can only have one
org.apache.velocity.app.Velocity per classloader, and i would not
recommend classloader tricks to have more.

you should use org.apache.velocity.app.VelocityEngine instead.  you
can have as many of those as you would like.

On 5/1/07, White, Tim <Ti...@qwest.com> wrote:
> Is there a way to initialize several velocity engines?  i.e. multiple
> singletons?
>
> Tim
>
>
> This communication is the property of Qwest and may contain confidential or
> privileged information. Unauthorized use of this communication is strictly
> prohibited and may be unlawful.  If you have received this communication
> in error, please immediately notify the sender by reply e-mail and destroy
> all copies of the communication and any attachments.
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org