NorbertKocsis/liferay-portal — pull request #13 by vilmospapp (2014-05-27 14:14:22+00:00)
Title: LPS-46585 Fix image loading by imageId in a sharded environment

Hi Norbi,

This fix solves the problem that in ImageService there's no way to identify the proper shard as no information is present to determine companyId, hence the default shard is used.

I applied the
```
try {
ShardUtil.pushComanyService(companyId);

// call problematic methods here
}
finally {
ShardUtil.popCompanyService();
```
pattern.

I know it's ugly, but ImageService has no companyId at all. In my opinion, the proper fix would be to refactor it completely to use companyId in the methods and apply a proper shardAdvice on it, or use the one I created here: https://github.com/migue/liferay-portal/pull/211 but I wasn't allowed to commit it yet because engineering still thinking about how to handle sharding related issues.

Should you have any concerns, please let me know.

Cheers,
Vilmos