patsystem-users Mailing List for PAT: Persistent Applications Toolkit
Brought to you by:
nthx
You can subscribe to this list here.
| 2005 |
Jan
|
Feb
|
Mar
|
Apr
(22) |
May
(18) |
Jun
(12) |
Jul
(1) |
Aug
|
Sep
(5) |
Oct
|
Nov
|
Dec
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(12) |
Dec
|
| 2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
| 2016 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Tomasz N. <nt...@ir...> - 2005-09-30 08:33:07
|
Michael Frieß <MichaelFriess <at> gmx.net> writes: > Hi, > you wrote on your > Homepage "Though, it still allows integration with relational databases." (on http://patsystem.sourceforge.net/about.html at > the very bottom). > > How can one use PAT > with MySQL (or Oracle)? I would appreciate it if you could give me > some more information on that topic. > > Thanks, > Michael Well. There are several options. First of all external storage like RDBMS allows one to store a _lot_ of data outside the main memory. That's advantage when there is really huge amount of data. It is advicable in this situation to simply store/load part of your business objects outside of main-memory/PAT/Prevayler. Let's take historical data as an example: an information about when an user makes a transfer of money. There could be lot of simple Record objects in the database. (How you load/store/map them is up to you) So the User class might look like this: User { String name; //... List<Record> records; } Or better (the example uses Spring's JDBCTemplate, google: equinox, https://equinox.dev.java.net/) UserManager { //.. public List getHistoricalRecordsOfUser(User user) { return new UsersQuery(getDataSource()).executeQuery(); } } //adapt this class RecordsQuery extends MappingSqlQuery { public RecordsQuery(DataSource ds) { super(ds, "SELECT * FROM user_historical_ops"); compile(); } protected Object mapRow(ResultSet rs, int rowNum) throws SQLException { Record record = new Record(); record.setId(new Long(rs.getLong("id"))); record.setWhat(rs.getString("type")); record.setWhen(rs.getString("when")); //etc... return record; } } Every single developer may introduce RDBMS to projects using PAT without much problems (except the RDBM maintenance). Just a custom developing needed to load/store data in a RDBMS. And that gives you 2 things: simplicity and speed of data layer using PAT and flexibility and interoperability of RDBMS. The next scenario is to integrate with an external RDBM system. That'd be also not a problem. One can use some sort of network protocols to exchange data (Hessian, RMI or whatever exists there). So everything is about customisation and a common sense. Use PAT for as the primary data layer (because simplifies development up) and integrate it with a RDBM when the need comes. I hope that helps. Sorry for a lag with the reply. Tomasz |
|
From: Tomasz N. <Tom...@ii...> - 2005-09-19 10:58:29
|
On the next beautiful day: Mon, 19 September, 2005, Michael Frie=DF wrote= : > Hi, > =20 > I'm trying to build my project with the AOP Classloader. I'm getting th= e > following error message: > [..] > =20 > =20 > The funny things are, that 1) log4j is definitely loaded as you can see= on > the first three lines (my app uses log4j, too) and 2) it works fine if = I use > the AOP-compiler... (without the AOP Classloader) > =20 > Any ideas what might be the reason for the error? > =20 > Thanks, > Michael If you send/re-check the part of your build.xml (or whatever else) responsible for setting the classpath and invoking JBossAOP then it will be more helpfull to find the place. From what we see, there is a problem with the absence of the log4j.jar. Send the file please. Tomasz --=20 _i______'simplicity_is_the_key'__________tomasz_nazar _ii____'i_am_concern_oriented'________________PJKM.pl _iii__'patsystem.sf.net'___________________linux_user _Heaven_&_Fellows,_PPP______________________prevayler |
|
From: <Mic...@gm...> - 2005-09-19 10:30:14
|
Hi,
I'm trying to build my project with the AOP Classloader. I'm getting the
following error message:
_____
runClient:
[java] [12:09:06 ConsoleClient] INFO ConsoleClient is being
executed!
[java] [12:09:06 ofilingInterceptor] DEBUG profiling
eshop.test.ConsoleClient->test
[java] [12:09:06 ofilingInterceptor] DEBUG done (360ms)
[java] java.lang.NoClassDefFoundError: org/apache/log4j/Logger
[java] at
org.nthx.pat.RootCreationInterceptor.<clinit>(RootCreationInterceptor.java:5
0)
[java] at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[java] at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAcces
sorImpl.java:39)
[java] at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstruc
torAccessorImpl.java:27)
[java] at
java.lang.reflect.Constructor.newInstance(Constructor.java:274)
[java] at java.lang.Class.newInstance0(Class.java:308)
[java] at java.lang.Class.newInstance(Class.java:261)
[java] at
org.jboss.aop.advice.GenericAspectFactory.createPerClass(GenericAspectFactor
y.java:146)
[java] at org.jboss.aop.Advisor.addPerClassAspect(Advisor.java:487)
[java] at
org.jboss.aop.advice.ScopedInterceptorFactory.create(ScopedInterceptorFactor
y.java:52)
[java] at
org.jboss.aop.Advisor.createInterceptorChain(Advisor.java:531)
[java] at
org.jboss.aop.Advisor.resolveConstructorPointcut(Advisor.java:696)
[java] at
org.jboss.aop.ClassAdvisor.createInterceptorChains(ClassAdvisor.java:454)
[java] at org.jboss.aop.ClassAdvisor$1.run(ClassAdvisor.java:233)
[java] at java.security.AccessController.doPrivileged(Native
Method)
[java] at
org.jboss.aop.ClassAdvisor.attachClass(ClassAdvisor.java:205)
[java] at
org.jboss.aop.AspectManager.getAdvisor(AspectManager.java:439)
[java] at eshop.pojo.biz.EShopApp.<clinit>(EShopApp.java)
[java] at
eshop.test.ConsoleClient.eshop$test$ConsoleClient$test$aop(ConsoleClient.jav
a:106)
[java] at
eshop.test.ConsoleClient$test_N7986479998679492778.invokeNext(ConsoleClient$
test_N7986479998679492778.java)
[java] at
eshop.aop.SimpleProfilingInterceptor.invoke(SimpleProfilingInterceptor.java:
91)
[java] at
eshop.test.ConsoleClient$test_N7986479998679492778.invokeNext(ConsoleClient$
test_N7986479998679492778.java)
[java] at eshop.test.ConsoleClient.test(ConsoleClient.java)
[java] at eshop.test.ConsoleClient.main(ConsoleClient.java:88)
[java] Exception in thread "main"
_____
The funny things are, that 1) log4j is definitely loaded as you can see on
the first three lines (my app uses log4j, too) and 2) it works fine if I use
the AOP-compiler... (without the AOP Classloader)
Any ideas what might be the reason for the error?
Thanks,
Michael
|
|
From: <Mic...@gm...> - 2005-09-17 17:59:43
|
Hi, you wrote on your Homepage "Though, it still allows integration with relational databases." (on http://patsystem.sourceforge.net/about.html at the very bottom). How can one use PAT with MySQL (or Oracle)? I would appreciate it if you could give me some more information on that topic. Thanks, Michael |
|
From: Tomasz N. <Tom...@ii...> - 2005-09-16 16:00:10
|
> From: Michael
> The problem occures when I am trying to create objects. If I create them
> instantly (= assigning their values within their constructor):
> HelpMePlz help = new HelpMePlz("pat");
> and restart my application, then their are correctly reloaded
> However if I create them with an empty constructor:
> HelpMePlz help = new HelpMePlz();
> help.setAbout("pat");
> and then assigning their values with setter methods and restarting my
> application, they are loaded as "null" objects
Yep!
You missed out '@pat.transaction' on setter method ('setAbout(..)'). :)
I will try to emphasize this better on the webpage:
Even setters change state of your objects, so you also have to annotate
them.
So in your code:
/**
* @@pat.bo
*/
public class Bonbon
{
//..
public void setNumber(int number) //<-- has to have @pat.transaction
{
this.number = number;
}
}
As you know JBossAOP, you can use regular expressions instead having
annotation inside the code:
<aop>
<annotation-introduction expr="execution(void @pat.bo->set*(..))">
@pat.transaction
</annotation-introduction>
</aop>
(put above inside jboss-aop.xml, put the file into META-INF dir, and
packa as my-configuration.jar, put into classpath).
This saves some amount of code, but on the other hand ... you have to
manage external file instead of having annotations inside the source.
You choose what's the best for you :)
Take care, and good luck with your essay - Tomasz
--
_i______'simplicity_is_the_key'__________tomasz_nazar
_ii____'i_am_concern_oriented'________________PJKM.pl
_iii__'patsystem.sf.net'___________________linux_user
_Heaven_&_Fellows,_PPP______________________prevayler
|
|
From: Tomasz N. <Tom...@ii...> - 2005-07-01 03:39:53
|
Hi there! I've just released a template of a web appliation which uses PAT. If anyone uses Struts then he is happy with that as it is based on it. Validation and struts-el, language properties also included. The basic functionality includes creating an object and presenting a list of all objects existing in the system. Not too much but a piece of good code to start with.. Just copy downloaded 'pat-struts-template.war' into you favourite TOMCAT installation and you're almost there. One also has to setup 'jboss.aop.path' for Tomcat - but the application is so smart ;) it informs if it's done. It isn't so smart to setup this property, though. :( Details: http://patsystem.sourceforge.net/struts_template.html Cheers! t. -- _i______'simplicity_is_the_key'__________tomasz_nazar _ii____'i_am_concern_oriented'__________________iiuwr _iii__'patsystem.sf.net'___________________linux_user _Heaven_&_Fellows,_PPP______________________prevayler |
|
From: Tomasz N. <Tom...@ii...> - 2005-06-24 23:29:14
|
On the next beautiful day: Fri, 24 June, 2005, Vladimir Atehort=FAa wrote=
:
> Hi
>=20
>=20
> >PAT doesn't. You can.
> >((org.nthx.pat.Persisteble)root).removeBO(oid);
>=20
> I reaally wish I dont have my business objects (where logic belongs) co=
upled/aware_of org.nthx.pat.Persisteble.
Of course :)
> >Map consists of two 4 keys-values:
> >1 -> root (we need to keep that object)
> >2 -> root.child
> >3 -> other (this should be garbage collected soon)
> >4 -> other.andHisChild
>=20
> >happen? How can any weak hashMap recognize to remove 'other' (among wi=
th
> >his children) and not 'root' (with children)?=20
>=20
> >There are no references to OID: 1 and OID: 3.
> >I think there might be some tricky hack to that. I just didn't have ti=
me
>=20
> If i'm not wrong, it should be rather easy:
>=20
> public IdentityMapMixin()
> {
> uniqueOID =3D 1L;
> map =3D new org.apache.commons.collections.map.ReferenceMap; =
// should use a map with strong keys and soft values.
Can you handle writing a JUnit test case for that:
Steps:
1) create sample data for PAT (u may use org.nthx.pat.demo or add
anything you need to src/tests/)
2) take snapshot
3) Pat.unload() or whatever it takes - maybe even shutdown of the whole V=
M=20
will be necessary .. yeap, I think so.
4) restore data by creating root again and asserting:
a) are objects on the place
b) there are no garbage in IdentityMap
5) Of course change to IdentityMapMixin is necessary.
Can you? :)
If it will work I will include _your_ contribution to PAT.
t.
--=20
_i______'simplicity_is_the_key'__________tomasz_nazar
_ii____'i_am_concern_oriented'__________________iiuwr
_iii__'patsystem.sf.net'___________________linux_user
_Heaven_&_Fellows,_PPP______________________prevayler
|
|
From: <vla...@ip...> - 2005-06-24 23:17:31
|
Hi
>> =BFhow does PAT handle the "old objects eat all ram" issue?
>PAT doesn't. You can.
>Just write on OID down, and use
>((org.nthx.pat.Persisteble)root).removeBO(oid);
>in the appropriate moment..
I reaally wish I dont have my business objects (where logic belongs) =
coupled/aware_of org.nthx.pat.Persisteble.
>I was looking at WeakHashMap, but it isn't serializable (I don't know =
if
>making it Serializable would cause sth extra..), and second: I'm not
>sure how exactly does it work when (de)serializing such IdentityMap.
>
>If you have some experience on that, share it here.
weakHashMap definitelly won't cut it.
weakhashmap holds soft references for the KEYS, which in PAT case's are =
the OIDs.
As soon as no one holds a strong refference to any OID, the OID key will =
be removed from the map and thus the BO (map value). this is not what we =
want because most likely OIDs are not used, pure pojo references are. =
composite objects instead of DB foreign keys.
jakarta commons collections offers Maps that hold soft or weak =
references on the Values rather than the keys.
this means that if a BO is not reachable from another BO (meaning, it =
can't be reached indirectly from the root), only then could it be GC'd. =
I think this is what we want.
Using jakarta common's collections ReferenceMap, the difference between =
weakreference and softreference lies only in timing:
* an object being weak referenced is erased as soon as the object is not =
reachable (by other "real" strong refferences).
* an object being soft referenced is not erased immediatly when it =
becomes not reachable, but later, when (if) memory gets tight.
Dont even consider using sun's default weakhashmap.
>Here is example on the problem I just can't solve..
>I'm not sure how all weak hashMaps solve following problem:
>Map consists of two 4 keys-values:
>1 -> root (we need to keep that object)
>2 -> root.child
>3 -> other (this should be garbage collected soon)
>4 -> other.andHisChild
>'root' is our ROOT. Object 2 is referenced by root and stored in IM
>(IdentityMap). Object 3 however, is stored in IM (cause it was created)
>but is not referenced by anyone and should be removed in the next
>session.
>So we close application, take snapshot, open application, and what =
will
>happen? How can any weak hashMap recognize to remove 'other' (among =
with
>his children) and not 'root' (with children)?=20
>There are no references to OID: 1 and OID: 3.
Only sun's weakhashmap needs references to OID's.
If you use jakarta commons, all you need is to somewhere hold areference =
to root. root itself holds references to its children, and they do the =
grandchildren. If any normal business logic makes an object unreachable, =
then it should be garbagecollected (BO's dont want to go to identitymap =
and look for it).
No object reachable from root will ever be garbage collected. Maybe =
RootCreationInterceptor can arrange for there being a strong reference =
to root somewhere, or maybe we need to turn root into a singleton object =
(referenced by its class, in a static field).
>I think there might be some tricky hack to that. I just didn't have =
time
>and didn't care. If you really need this we can think of it. I would be
>happy to see the solution and apply it to PAT. Want to contribute?
>:)
If i'm not wrong, it should be rather easy:
changing IdentityMapMixin's constructor to not use:
public IdentityMapMixin()
{
uniqueOID =3D 1L;
map =3D new HashMap();
}
but instead:
public IdentityMapMixin()
{
uniqueOID =3D 1L;
map =3D new org.apache.commons.collections.map.ReferenceMap; =
// should use a map with strong keys and soft values.
}
... of course, then add a new library, include it's license text etc. |
|
From: Tomasz N. <Tom...@ii...> - 2005-06-24 20:41:21
|
On the next beautiful day: Fri, 24 June, 2005, Vladimir Atehort=FAa wrote= : > Hi. >=20 > I've been re-checking the source, and it seems business objects never g= et garbage collected, mainly because the identity map holds strong refere= nces to them. For my primary app I just don't care about the problem. Persisteble interface of the root object provides the funcionality. I've never used it however. (where was YAGNI at the moment? ;) ) > =BFhow does PAT handle the "old objects eat all ram" issue? PAT doesn't. You can. Just write on OID down, and use ((org.nthx.pat.Persisteble)root).removeBO(oid); in the appropriate moment.. > I can only think of the obvious solution, which is using a Soft HashMap= instead of a regular hashmap. > Sun's provided weakhashmap wouldnt work because it holds weak refferenc= es to keys, and PAT needs weak refferences to values. I was looking at WeakHashMap, but it isn't serializable (I don't know if making it Serializable would cause sth extra..), and second: I'm not sure how exactly does it work when (de)serializing such IdentityMap. If you have some experience on that, share it here. Here is example on the problem I just can't solve.. I'm not sure how all weak hashMaps solve following problem: Map consists of two 4 keys-values: 1 -> root (we need to keep that object) 2 -> root.child 3 -> other (this should be garbage collected soon) 4 -> other.andHisChild 'root' is our ROOT. Object 2 is referenced by root and stored in IM (IdentityMap). Object 3 however, is stored in IM (cause it was created) but is not referenced by anyone and should be removed in the next session. So we close application, take snapshot, open application, and what will happen? How can any weak hashMap recognize to remove 'other' (among with his children) and not 'root' (with children)?=20 There are no references to OID: 1 and OID: 3. I think there might be some tricky hack to that. I just didn't have time and didn't care. If you really need this we can think of it. I would be happy to see the solution and apply it to PAT. Want to contribute? :) > Regards, > Vladimir Best regards, Tomasz --=20 _i______'simplicity_is_the_key'__________tomasz_nazar _ii____'i_am_concern_oriented'__________________iiuwr _iii__'patsystem.sf.net'___________________linux_user _Heaven_&_Fellows,_PPP______________________prevayler |
|
From: <vla...@ip...> - 2005-06-24 14:53:12
|
Hi. I've been re-checking the source, and it seems business objects never = get garbage collected, mainly because the identity map holds strong = references to them. =BFhow does PAT handle the "old objects eat all ram" issue? I can only think of the obvious solution, which is using a Soft HashMap = instead of a regular hashmap. Sun's provided weakhashmap wouldnt work because it holds weak = refferences to keys, and PAT needs weak refferences to values. I'd say the best candidate woul dbe jakarta commons collection's = "Reference Map" configured to use weak refferences: http://jakarta.apache.org/commons/collections/apidocs-COLLECTIONS_3_1/org= /apache/commons/collections/map/ReferenceMap.html Regards, Vladimir |
|
From: Tomasz N. <Tom...@ii...> - 2005-06-22 23:13:24
|
On the next beautiful day: Wed, 22 June, 2005, Vladimir Atehort=FAa wrote= : > Hello. >=20 Hi Vladimir! > This idea has been haunting me, so I want to share it to see what you t= hink: >=20 > Imagine one has a PAT system, where "business logic" resides where it s= hould: in the methods of the business objects. I call my set of business = objects my "domain model"=20 >=20 > Then I have some objects outside from the domain model (and outside the= pat system), that are interested in the objects inside the domain model.= like: >=20 >=20 > Unfortunately I don't know much about AOP, except from a few articles I= read online and the PAT code itself. >=20 > =BFwhat do you think of this? Well, I think you're becoming "aspectized" :) Before continuing with the topic have a look at JBoss' page about 'Observable" pattern. I think this is what you need. They've implemented the pattern using AOP. I haven't tried it in real life, but was looking at it before.=20 "Observing" concern is orthogonal to persistence (which PAT provides). Hence, I'm not so eager on mering it into PAT (for now). But for you this isn't any problem at all. You may use both together: PAT and Observabble aspect. Any help on that you need - just ask. PAT comes with default <PAT>/etc/your-aspects-here-aop.xml Put your custom aspect configurations (mixins, annotations, ..) there. You will probably have to copy contents of http://wiki.jboss.org/wiki/Wiki.jsp?page=3DGOFObserverableJBossAopXML into your-aspects-here-aop.xml file. The whole page about AOP'ed Observable pattern is here: http://wiki.jboss.org/wiki/Wiki.jsp?page=3DGOFObservable Get back here and tell the story how it worked out. Or if that's not what you need, then I'm open for discussion.. :) Tomasz PS. Few tips about JBossAOP: Tip 1: any annotation you see in the code (@@pat.bo for example) may be moved to configuration file (XML) (and vice-versa) Tip 2: there can be many AOP configuration files Tip 3: 'jboss.aop.path' system variable specifies path to your AOP XML files --=20 _i______'simplicity_is_the_key'__________tomasz_nazar _ii____'i_am_concern_oriented'__________________iiuwr _iii__'patsystem.sf.net'___________________linux_user _Heaven_&_Fellows,_PPP______________________prevayler |
|
From: <vla...@ip...> - 2005-06-22 19:49:33
|
Hello. This idea has been haunting me, so I want to share it to see what you = think: Imagine one has a PAT system, where "business logic" resides where it = should: in the methods of the business objects. I call my set of = business objects my "domain model"=20 Then I have some objects outside from the domain model (and outside the = pat system), that are interested in the objects inside the domain model. = like: * A swing GUI responsible for visualizing some of the business objects. = It wants to know when a visualized object has changed (as a result of a = PAT/prevayler transaction/command) in order to refresh the windows, = instead of -for example- repeated polling. It does not want to modify = them or anything. just display. I have some objects like this, with responsabilities that don't belong = in the domain model (like visualization), and those objects want to be = notified of changes is the domain objects (instead of for example, = repeated polling). The obvious solution is to do it "by hand" using the observer pattern: = to have my domain objects implement some "eventsource" interface, and my = external (GUI) objects implement some "eventlistener" interface, then = register the listeners to the selected sources and voil=E8 However, this not only becomes tedious (repeating trough every single = object the methods that implement "eventsource" (like = "registerNotificationListener", "notifyListeners", etc ), and is error = prone / pollutes the bussines objects, it also seems to be a natural = place to put AOP in action. In the same way that the PAT code merges clean POJO "business objects" = with those "mixin" implementations of PAT interfaces, I think a default = implementation could be made of "eventsource" interface and have the AOP = magic "mix" any business object with that class, thus having free = "beans/swing style event notification" for any business object existing = or future. Unfortunately I don't know much about AOP, except from a few articles I = read online and the PAT code itself. =BFwhat do you think of this? |
|
From: Tomasz N. <nt...@ir...> - 2005-06-20 22:36:59
|
Vladimir Atehortúa <vladimir.atehortua <at> iptotal.com> writes: > Hello all. > > I'd like to know what is PAT's > roadmap. Hi! First of all sorry for the delay. Your email haven't arrived to me.. very strange. It is on the list, but not in my mailbox.. > Where is it going, I mean it could be going towards > improving the prevalence layer to get improved performance (prevayler's site > says its transctions are slower than MySQL and SQLServer, altough queries are > much faster), or it could be coing towards new features in the AOP > arena. Forget about performance. I'm not on it. (Though nothing is faster than reading your memory :) - write speed is much more worse.) It's about simpler application model. AOP - as you've probably know - helps a lot here. Where is it going to? Who knows. Project is driven by a need. There isn't any roadmap here. When need arises... > Just a very small comment: > > in org.nthx.pat.IdentityMapMixin, in the constructor: > > public IdentityMapMixin() > { uniqueOID = 1L; map = new HashMap(); } > > > The hashmap is initializaed with no capacity. Be > aware that resizing a map always involve either rehashing or > copying the entire > contents of the map. Thus, map resizing should be avoided. If you > know how many > objects are expected to fit into the map (maybe from the highest OID) you can > avoid a ton of map resizing at startup (when the identity map is being > populated) and thus improve boot time. Thanks for looking into the source! :) If a great demand on the feature exists I could provide some sort of configuration for that... > Regards, > > Vladimir Atehortúa Take care, Tomasz Nazar |
|
From: Tomasz N. <Tom...@ii...> - 2005-06-20 22:12:55
|
ignore this.. -- _i______'simplicity_is_the_key'__________tomasz_nazar _ii____'i_am_concern_oriented'__________________iiuwr _iii__'patsystem.sf.net'___________________linux_user _Heaven_&_Fellows,_PPP______________________prevayler |
|
From: <vla...@ip...> - 2005-06-14 15:31:06
|
Hello all.
I'd like to know what is PAT's roadmap.
Where is it going, I mean it could be going towards improving the =
prevalence layer to get improved performance (prevayler's site says its =
transctions are slower than MySQL and SQLServer, altough queries are =
much faster), or it could be coing towards new features in the AOP =
arena.
Just a very small comment:
in org.nthx.pat.IdentityMapMixin, in the constructor:
public IdentityMapMixin()
{
uniqueOID =3D 1L;
map =3D new HashMap();
}
The hashmap is initializaed with no capacity. Be aware that resizing a =
map always involve either rehashing or copying the entire contents of =
the map. Thus, map resizing should be avoided. If you know how many =
objects are expected to fit into the map (maybe from the highest OID) =
you can avoid a ton of map resizing at startup (when the identity map is =
being populated) and thus improve boot time.
Regards,
Vladimir Atehort=FAa |
|
From: Tomasz N. <Tom...@ii...> - 2005-06-14 10:59:57
|
On the next beautiful day: Tue, 14 June, 2005, Chris wrote:
> Hi!
>
> I have following situation:
>
> /** @@pat.transaction */
> public void updateEntry(Entry entry, int id) {
> remove(id); // pat.transaction
> add(entry); // pat.transaction
> }
The similar examples are in the distro:
http://patsystem.sourceforge.net/api/org/nthx/pat/tests/RecursiveTransactionsTest.java.html
Test: 'testTransferMoney'
It should work the way you've described. Are you shure your test case
tests the right thing? ;)
T.
--
_i______'simplicity_is_the_key'__________tomasz_nazar
_ii____'i_am_concern_oriented'__________________iiuwr
_iii__'patsystem.sf.net'___________________linux_user
_Heaven_&_Fellows,_PPP______________________prevayler
|
|
From: Chris <ci...@ya...> - 2005-06-14 07:51:40
|
Hi!
I have following situation:
/** @@pat.transaction */
public void updateEntry(Entry entry, int id) {
remove(id); // pat.transaction
add(entry); // pat.transaction
}
the above method updates entry by removing the old one
and then inserting the new one.
After running this method I get what I expect, the
fields in entry are updated. I checked it no problem.
But it should be acomplished as a pat.transaction so
the changes should be visible after reloading the
application. But they're not updated.
But in the same situation after running updateEntry
method when I run takeSnapshot(), after reloading
everything is fine. The entry is updated.
Where is the problem, what am I forgetting?
thanks for help
ciapecki
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
|
|
From: Tomasz N. <Tom...@ii...> - 2005-06-02 12:32:33
|
Hi there! PAT-M1-06 was released few days ago. I suggest you to add: http://patsystem.sourceforge.net/rss.xml to your favourite RSS reader if you haven't done it already. What has changed: Only minor changes: Docs updated - it is worth to have a look at: docs/htdocs/framework.gtml#transactionsArgs at least. Fixed since M1-05: a) Pat.unload() stays b) when instantiating ROOT second time exception with a warning is thrown Also, I blogged a little about Ilybra (app which uses PAT) and aspects here: http://www.ii.uni.wroc.pl/~nthx/blog/ Take care, Tomasz Nazar -- _i______'simplicity_is_the_key'__________tomasz_nazar _ii____'i_am_concern_oriented'__________________iiuwr _iii__'patsystem.sf.net'___________________linux_user _Heaven_&_Fellows,_PPP______________________prevayler |
|
From: Tomasz N. <Tom...@ii...> - 2005-05-12 16:55:21
|
On Thu, May 12, 2005 at 06:08:22AM -0700, Chris wrote: > > build.xml: (it isn't necessary, but for safety I've > > changed it) > > <target name="test" description="run tests" > > depends="clean, compile"> > > > > ^^^^^ > > Now it works (at least under Linux) ;) > The clean target helped, maybe there were some tedious > classes from the previous builds. > > later will try under Windows. > > thanks a lot > ciapek > > Krzysztof Cierpisz Thanks a lot to you ;) Check in on Windows in spare time and let me know.. see you, t. -- _i______'simplicity_is_the_key'__________tomasz_nazar _ii____'i_am_concern_oriented'__________________iiuwr _iii__'patsystem.sf.net'___________________linux_user _Heaven_&_Fellows,_PPP______________________prevayler |
|
From: Chris <ci...@ya...> - 2005-05-12 13:08:32
|
> build.xml: (it isn't necessary, but for safety I've > changed it) > <target name="test" description="run tests" > depends="clean, compile"> > > ^^^^^ Now it works (at least under Linux) ;) The clean target helped, maybe there were some tedious classes from the previous builds. later will try under Windows. thanks a lot ciapek Krzysztof Cierpisz .......................... gg: 2349371 .............. mobile: (+49 176) 23329677 phone: (+49 89) 95482147 Yahoo! Mail Stay connected, organized, and protected. Take the tour: http://tour.mail.yahoo.com/mailtour.html |
|
From: Tomasz N. <Tom...@ii...> - 2005-05-12 10:48:01
|
On Wed, May 11, 2005 at 10:42:20PM -0700, Chris wrote:
> > Ciapek, please re-run your test cases with M1-05 on
> > Windows and report
> > results here, if you may. Thanks!
>
> I just did that (Windows), but it looks worse than
> before:
> Even the simple constructor Register() doesn't go
> through:
>
> java.lang.NoSuchMethodException: getSize
^^^
So this above was due to old libs, right? ;)
>
> ciapek
build.xml: (it isn't necessary, but for safety I've changed it)
<target name="test" description="run tests" depends="clean, compile">
^^^^^
sources/register/tests/RegisterTest.java:
public void testConstructorGivenEntries() {
entries = new ArrayList();
entries.add(sampleEntry);
register=new Register((ArrayList)entries);
assertEquals(1,register.getNumberOfEntries());
}
public void testConstructorGivenEmptyEntries()
{
register = new Register(new ArrayList());
assertEquals(0,register.getNumberOfEntries());
}
One has to execute Pat.unload(), before every ROOT constructor.
So in this case 'Pat.unload()' exists inside 'setUp()', what makes it
the same.
So, you have to split your test into two. They test different things
anyway, right?
Take care,
t.
PS. I'll make 'new ROOT(..) triggers Pat.unload()' default behaviour
in next major release.
--
_i______'simplicity_is_the_key'__________tomasz_nazar
_ii____'i_am_concern_oriented'__________________iiuwr
_iii__'patsystem.sf.net'___________________linux_user
_Heaven_&_Fellows,_PPP______________________prevayler
|
|
From: Tomasz N. <Tom...@ii...> - 2005-05-12 09:44:48
|
On Wed, May 11, 2005 at 10:42:20PM -0700, Chris wrote: > > Ciapek, please re-run your test cases with M1-05 on > > Windows and report > > results here, if you may. Thanks! > > I just did that (Windows), but it looks worse than > before: > Even the simple constructor Register() doesn't go > through: > > Caused by: java.lang.RuntimeException: > java.lang.NoSuchMethodException: getSize > > The same Failure I get running Register(List) > testCase. > > maybe you change something in > prevayler1-for_pat-M1-04.jar and I should update it? > > ciapek > > Krzysztof Cierpisz Remove lib/*04*.jar cp <PAT>/dist/*.jar <REGISTER>/lib/ If this won't help, may you send me the whole test case once more? thnx t. -- _i______'simplicity_is_the_key'__________tomasz_nazar _ii____'i_am_concern_oriented'__________________iiuwr _iii__'patsystem.sf.net'___________________linux_user _Heaven_&_Fellows,_PPP______________________prevayler |
|
From: Chris <ci...@ya...> - 2005-05-12 05:42:27
|
> Ciapek, please re-run your test cases with M1-05 on > Windows and report > results here, if you may. Thanks! I just did that (Windows), but it looks worse than before: Even the simple constructor Register() doesn't go through: Testcase: testConstructor(register.tests.RegisterTest): Caused an ERROR null java.lang.ExceptionInInitializerError at register.tests.RegisterTest.testConstructor(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) Caused by: java.lang.RuntimeException: java.lang.NoSuchMethodException: getSize at org.jboss.aop.ClassAdvisor.attachClass(ClassAdvisor.java:250) at org.jboss.aop.AspectManager.getAdvisor(AspectManager.java:321) at register.Register.<clinit>(Unknown Source) ... 16 more Caused by: java.lang.NoSuchMethodException: getSize at org.jboss.aop.ClassAdvisor.getMethod(ClassAdvisor.java:261) at org.jboss.aop.ClassAdvisor.getMethod(ClassAdvisor.java:269) at org.jboss.aop.ClassAdvisor.populateMixinMethods(ClassAdvisor.java:332) at org.jboss.aop.ClassAdvisor$1.run(ClassAdvisor.java:228) at java.security.AccessController.doPrivileged(Native Method) at org.jboss.aop.ClassAdvisor.attachClass(ClassAdvisor.java:209) ... 18 more The same Failure I get running Register(List) testCase. maybe you change something in prevayler1-for_pat-M1-04.jar and I should update it? ciapek Krzysztof Cierpisz .......................... gg: 2349371 .............. mobile: (+49 176) 23329677 phone: (+49 89) 95482147 __________________________________ Yahoo! Mail Mobile Take Yahoo! Mail with you! Check email on your mobile phone. http://mobile.yahoo.com/learn/mail |
|
From: Tomasz N. <Tom...@ii...> - 2005-05-11 20:32:54
|
On Tue, May 10, 2005 at 03:22:42AM -0700, Chris wrote:
> > Watch this..
> >
> > public void testConstructorGivenEntries()
> > {
> > register = new Register(new ArrayList());
> >
> > assertEquals(0,register.getNumberOfEntries());
> > entries = new ArrayList();
> > entries.add(sampleEntry);
> > register.setEntries(entries);
> >
> > assertEquals(1,register.getNumberOfEntries());
> > }
> >
>
> when I run exactly the same configuration you wrote, I
> got Failure:
>
> Maybe that's the problem of Windows, I will try later
> at home on Linux box. It looks like setUp() didn't
> reset Pat and there's still the sampleEntry added in
> the first Test.
Ciapek, please re-run your test cases with M1-05 on Windows and report
results here, if you may. Thanks!
http://prdownloads.sourceforge.net/patsystem/pat-M1-05.tgz?download
Take care,
Tomasz
--
_i______'simplicity_is_the_key'__________tomasz_nazar
_ii____'i_am_concern_oriented'__________________iiuwr
_iii__'patsystem.sf.net'___________________linux_user
_Heaven_&_Fellows,_PPP______________________prevayler
|
|
From: Tomasz N. <Tom...@ii...> - 2005-05-11 20:30:43
|
Hi guys! New release ready to download. http://prdownloads.sourceforge.net/patsystem/pat-M1-05.tgz?download Please download and run tests on Windows: $ ant tests And report to me if that pass or fails. Thanks. ==== This is from RSS feed: http://patsystem.sourceforge.net/rss.xml 1. M1-05 release Docs simplified. Fixed since M1-04: a) dist/*.jar are now synchronized with src b) a try to fix Windows-tests failures I encourage you to at least look through web pages. Please test for yourselves if tests run on Windows (and report). ==== Take care, Tomasz Nazar -- _i______'simplicity_is_the_key'__________tomasz_nazar _ii____'i_am_concern_oriented'__________________iiuwr _iii__'patsystem.sf.net'___________________linux_user _Heaven_&_Fellows,_PPP______________________prevayler |