Questions tagged [lazy-initialization]
Lazy initialization is the tactic of delaying the creation of an object, the calculation of a value, or some other expensive process until the first time it is needed.
lazy-initialization
718
questions
2
votes
1
answer
47
views
Scala initialization order object vs. val
In the following program an object is reported as null, even though it is clearly initialized.
class MyClass()
class MyOtherClass(c: MyClass)
object Foo {
val myClass = new MyClass()
object ...
-1
votes
1
answer
47
views
Fetching hibernate lazy loaded objects in threads
I am using Hibernate 5.3, Spring and Java 8.
Our application is an enterprise application, initially created on struts and then some new development is being done in Spring. Spring is not properly ...
0
votes
1
answer
20
views
Spring boot: dependency cycle between beans could not be broken
I am working on creating an Airline website using Spring Boot. I have a Seat class and a Flight class which represent tables in the database. The idea is that whenever a flight is added, seats for the ...
0
votes
1
answer
21
views
TransientObjectException during commit when adding entity to an uninitialized lazy collection in Hibernate
Assume, we have two simple entities Parent and Child like the following:
@Entity
public class Parent extends BaseEntity {
private String content;
@OneToMany(mappedBy = "parent", ...
0
votes
1
answer
38
views
Instantiate lazy val which depends on runtime parameter in concurrent env
I need to instantiate MyHttpClient as Singleton. MyHttpClient is used by multiple threads.
Solution below works, but it's ugly and should have issue with endpoint, I just didn't hit it yet.
endpoint ...
-2
votes
1
answer
85
views
Selenium WebDriver PageFactory Webelement initialization
I have more than 500 web-elements in a webpage. If I use Page Object Model with PageFactory.initElements() in selenium it will initialize all the elements once the object is created.
Lets says I am ...
1
vote
0
answers
41
views
Issue with Re-rendering of Horizontal ScrollView Inside Vertical ScrollView in SwiftUI
I am encountering an issue with re-rendering of a horizontal ScrollView inside a vertical ScrollView in SwiftUI. The vertical ScrollView contains multiple horizontal ScrollViews, each displaying a ...
1
vote
1
answer
146
views
Using AtomicReference for lazy init
can the lazy init be done safely this way? We had a dispute where a colleague was claming for some first threads it could fail and they would see the null value.
public class TestAtomicReference {
...
0
votes
0
answers
342
views
build on top of Kickstart Neovim
build on top of Kickstart Neovim
I m a noob using the git repo
https://github.com/nvim-lua/kickstart.nvim to configure Neovim
In the instructions inside the init.lua https://github.com/nvim-lua/...
0
votes
1
answer
124
views
How to Initialize Redux Store asynchronously?
I have a Next.js Application and for State Management I am using Redux Toolkit. Now, to maintain authentication status in frontend side, I need to take the existing token and send it to backend for ...
1
vote
1
answer
240
views
Am I using in a wrong way async lazy initialization?
I have a view model with 2 collections, that takes the data from database. For example countries and type of VAT.
I would like to defer the initialization of this collections until I will, becauase if ...
0
votes
0
answers
38
views
Fortran: Initialization of allocatable array with another array [duplicate]
I read a Fortran code :
program t
real :: x(5) =[1.,-2.,3.,-4.,5.]
real,allocatable :: y(:)
y = x
...
For me the normal way is
allocate(y,source=x)
I'm surprised that it works, ...
1
vote
2
answers
163
views
Racy Single-Check Idiom with Intermediate Result
The racy single-check idiom is a technique for lazy initialization without synchronization or volatile. It can be used when initialization is allowed to be performed concurrently by multiple threads, ...
2
votes
0
answers
96
views
Faster loading of R Markdown html document
Dear StackOverflow members,
I am creating big html documents using R Markdown. These documents contain 200 till 300 charts generated using ggplotly. The creation/knitting of these files works well. ...
-2
votes
1
answer
88
views
Use object guarded by Mutex
I want to implement a lazy static reqwest::ClientBuilder. NB this is for a utilities module, so I have a feeling it'd be difficult to avoid using a static in this case. I want to construct it once, ...